Make update-data workflow manually triggerable #23
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 to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| if: >- | |
| github.event_name == 'workflow_dispatch' || | |
| contains(github.event.head_commit.message, 'Update data') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: app/package-lock.json | |
| - name: Install dependencies | |
| run: | | |
| cd app | |
| npm ci | |
| - name: Get commit info | |
| id: commit | |
| run: | | |
| echo "hash=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cs)" >> $GITHUB_OUTPUT | |
| - name: Build | |
| run: | | |
| cd app | |
| npm run build | |
| env: | |
| VITE_COMMIT_HASH: ${{ steps.commit.outputs.hash }} | |
| VITE_COMMIT_DATE: ${{ steps.commit.outputs.date }} | |
| - name: Copy data folder to build output | |
| run: | | |
| cp -r data app/dist/data | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./app/dist | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |