feat: use Quarto listing to create gallery #479
Workflow file for this run
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
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| # to be able to trigger a manual build | |
| workflow_dispatch: | |
| name: Render and Deploy Site to GitHub Pages Using Freeze Cache | |
| # https://github.com/r-lib/actions/tree/v2/examples#render-rmarkdown | |
| # https://github.com/quarto-dev/quarto-actions | |
| env: | |
| isExtPR: ${{ github.event.pull_request.head.repo.fork == true }} | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| build-deploy: | |
| runs-on: ubuntu-latest | |
| # Only restrict concurrency for non-PR jobs | |
| concurrency: | |
| group: quarto-publish-${{ github.event_name != 'pull_request' || github.run_id }} | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Quarto | |
| uses: quarto-dev/quarto-actions/setup@v2 | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tinytex: true | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| - name: Scan .qmd for dependencies and update | |
| run: Rscript update-dependencies.R | |
| - name: Commit the updated DESCRIPTION | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| git config --local user.name "$GITHUB_ACTOR" | |
| git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| git commit DESCRIPTION -m 'chore: Update dependencies' || echo "No changes to commit" | |
| git push origin || echo "No changes to commit" | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| # - name: Render Quarto Project | |
| # uses: quarto-dev/quarto-actions/render@v2 | |
| # env: | |
| # QUARTO_PROFILE: preview | |
| - name: Render website with Babelquarto | |
| run: Rscript -e 'babelquarto::render_website()' | |
| - name: Upload Quarto artifacts | |
| if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }} | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: "_site" | |
| - name: Commit the updated _freeze | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| if [ -d "_freeze" ] && [ -n "$(ls -A _freeze)" ]; then | |
| git add -A _freeze | |
| git commit -m 'chore: update frozen contents' || echo "No changes to commit" | |
| git push origin || echo "No changes to push" | |
| else | |
| echo "_freeze is empty or missing, skipping" | |
| fi | |
| - name: Deploy to GitHub Pages | |
| if: github.event_name != 'pull_request' | |
| uses: quarto-dev/quarto-actions/publish@v2 | |
| with: | |
| target: gh-pages | |
| render: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |