doc(readme): intro easiest install meth and nimpylib #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: playground-deploy | |
| # yamllint disable-line rule:truthy | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - v*.* | |
| workflow_dispatch: | |
| env: | |
| nim-version: 'stable' | |
| git-repo-url: https://github.com/${{ github.repository }} | |
| deploy-dir: .gh-pages | |
| jobs: | |
| docs: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache nimble | |
| id: cache-nimble | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nimble | |
| key: ${{ runner.os }}-nimble | |
| - uses: jiro4989/setup-nim-action@v1 | |
| with: | |
| nim-version: ${{ env.nim-version }} | |
| - name: install karax | |
| run: nimble install karax | |
| - name: buildKarax | |
| run: | | |
| nimble buildKarax \ | |
| -d:homepage="${{ github.event.repository.homepage }}" -d:gitRepoUrl="${{ env.git-repo-url }}" \ | |
| -d:release --opt:size --includeJs \ | |
| --htmlName=index | |
| - name: "CNAME" | |
| run: mkdir ${{ env.deploy-dir }} || true | |
| - name: mv to deploy dir | |
| run: mv index.html ${{ env.deploy-dir }}/index.html | |
| - name: create deploy-dir if needed | |
| run: | | |
| cname=$(echo ${{ github.event.repository.homepage }} | grep -oP 'https?://\K[^/]+') | |
| prefix="play." | |
| # py: if not cname.startswith(prefix) | |
| # bash: if [[ "${cname}" != $prefix* ]] | |
| if [ ${cname##$prefix} = $cname ]; then | |
| cname="${prefix}${cname}" | |
| fi | |
| echo -n $cname > ${{ env.deploy-dir }}/CNAME | |
| # We must re-build CNAME as we use 'peaceiris/actions-gh-pages@v4', | |
| # where the old dir (including CNAME) will be purged. | |
| - name: Deploy documents | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ${{ env.deploy-dir }} |