Add GHA to publish documentation #133
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: Dev build | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Dev build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: r-lib/actions/setup-r@v2 | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| dependencies: NA | |
| extra-packages: any::devtools | |
| - name: Build package | |
| run: | | |
| # Workaround for bug #1070 in roxygen2 7.1.0 | |
| writeLines('# Generated by roxygen2: do not edit by hand', 'NAMESPACE') | |
| devtools::document() | |
| shell: Rscript {0} | |
| - name: Commit development build | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name klmr | |
| git config user.email klmr@users.noreply.github.com | |
| git remote set-url --push origin https://klmr:$GITHUB_TOKEN@github.com/klmr/box.git | |
| git branch -D build 2>/dev/null || : | |
| git checkout -b build | |
| git add --force NAMESPACE man | |
| git commit -m 'Create a development build' | |
| git push --force origin build | |
| docs: | |
| name: Publish documentation | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: r-lib/actions/setup-r@v2 | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| dependencies: NA | |
| extra-packages: any::pkgdown | |
| - name: Build documentation | |
| run: | | |
| git checkout build | |
| make site | |
| - name: Publish documentation | |
| run: | | |
| git config user.name klmr | |
| git config user.email klmr@users.noreply.github.com | |
| git remote set-url --push origin https://klmr:$GITHUB_TOKEN@github.com/klmr/box.git | |
| git branch -D site 2>/dev/null || : | |
| git checkout -b site | |
| git add --force docs | |
| git commit -m 'Build documentation' | |
| git push --force origin site |