Merge branch 'main' of https://github.com/MonashBioinformaticsPlatfor… #72
This file contains 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: Build bookdown -> Github Pages | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
bookdown-render: | |
runs-on: ubuntu-latest | |
# Only restrict concurrency for non-PR jobs | |
concurrency: | |
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-renv@v2 | |
- name: Cache bookdown results | |
uses: actions/cache@v4 | |
with: | |
path: _bookdown_files | |
key: bookdown-${{ hashFiles('**/*Rmd') }} | |
restore-keys: bookdown- | |
- name: Build site | |
run: bookdown::render_book("index.Rmd", quiet = TRUE) | |
shell: Rscript {0} | |
- name: Upload artifact for Pages | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'docs' | |
# This makes a commit of the changed files in 'docs' to the main branch | |
# Not really what we want | |
# - uses: EndBug/add-and-commit@v9 | |
# with: | |
# add: 'docs' | |
# message: 'Rebuild html (Github Actions)' | |
# push: true | |
- name: Checkout gh-pages branch | |
#run: git checkout gh-pages | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- name: Push docs to gh-pages branch | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: 'docs -f' | |
message: 'Rebuild html (Github Actions)' | |
push: 'origin gh-pages --set-upstream --force' | |
deploy: | |
needs: bookdown-render | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
if: github.event_name != 'pull_request' | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
# - name: Deploy to GitHub pages 🚀 | |
# if: github.event_name != 'pull_request' | |
# uses: JamesIves/github-pages-deploy-action@v4.5.0 | |
# with: | |
# branch: main | |
# folder: docs |