I wrote a workflow to generate documents with `nimble doc` and release to 
GitHub Pages in GitHub Actions.

This workflow deploys HTML to `gh-pages` branch. See also: [About GitHub Pages 
- GitHub 
Docs](https://docs.github.com/en/github/working-with-github-pages/about-github-pages)
    
    
    name: docs
    
    on:
      push:
        tags:
          - 'v*.*.*'
    
    env:
      nim-version: stable
      nim-src: src/YOUR_PROGRAM.nim
      deploy-dir: .gh-pages
    
    jobs:
      docs:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v1
          - uses: jiro4989/setup-nim-action@v1
            with:
              nim-version: ${{ env.nim-version }}
          - run: nimble doc --index:on --project --out:${{ env.deploy-dir }} 
${{ env.nim-src }}
          - name: Deploy documents
            uses: peaceiris/actions-gh-pages@v3
            with:
              github_token: ${{ secrets.GITHUB_TOKEN }}
              publish_dir: ${{ env.deploy-dir }}
    
    Run

CI runs when you create a new tags.
    
    
    $ git tag v0.1.0
    $ git push origin v0.1.0
    
    Run

Generated document is below.

[https://jiro4989.github.io/faker/faker.html](https://jiro4989.github.io/faker/faker.html)

If you want to generate documents when `master` branch was updated, change 
below.
    
    
    on:
      push:
        branches:
          - master
    
    Run

Examples: 
[https://github.com/jiro4989/faker/blob/master/.github/workflows/docs.yml](https://github.com/jiro4989/faker/blob/master/.github/workflows/docs.yml)

Reply via email to