Deploy quarto site to GitHub Pages #91
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: Deploy quarto site to GitHub Pages | |
| on: | |
| # Runs on pushes targeting the default branch | |
| push: | |
| branches: ['main'] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Build step runs on each pull request | |
| pull_request: | |
| schedule: | |
| # Runs at 6am UTC every day | |
| - cron: '10 6 * * *' | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| env: | |
| GRAPHQL_TOKEN: ${{ secrets.GRAPHQL_TOKEN }} | |
| PEPY_API_KEY: ${{ secrets.PEPY_API_KEY }} | |
| ORGANIZATION_NAME: ${{ vars.ORGANIZATION_NAME }} | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: false | |
| jobs: | |
| # Build job | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Get current date | |
| id: date | |
| run: echo "DATE=$(date +'%Y-%m')" >> $GITHUB_ENV | |
| - name: Restore conda downloads cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.dashboard | |
| key: conda-download-cache-${{ env.DATE }} | |
| restore-keys: | | |
| conda-download-cache- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install '.[dev]' | |
| - name: Fetch and save data | |
| run: python -m oss_dashboard.main | |
| - name: Set up Quarto | |
| uses: quarto-dev/quarto-actions/setup@v2 | |
| # Render site | |
| - name: Render site | |
| run: quarto render | |
| # Deploy to GitHub Pages | |
| - name: Deploy to GitHub Pages | |
| if: ((github.ref == 'refs/heads/main') && (github.event_name == 'push' || github.event_name == 'schedule')) || github.event_name == 'workflow_dispatch' | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./build |