Merge branch 'main' of github.com:bamlab/open-source-visualizer #8
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: Fetch data & deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| schedule: | |
| - cron: '0 */6 * * *' # refresh data every 6 hours | |
| workflow_dispatch: # manual trigger from the Actions tab | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Fetch npm, pub.dev & GitHub data | |
| run: bun scripts/fetch-data.ts | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Persist pub.dev monthly snapshot | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add public/data.json | |
| git diff --staged --quiet || git commit -m "chore: update pub.dev monthly snapshot [skip ci]" | |
| git push | |
| - name: Build | |
| run: bun run build | |
| env: | |
| VITE_BASE_URL: /${{ github.event.repository.name }}/ | |
| - name: Configure Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: dist | |
| - name: Deploy to GitHub Pages | |
| id: deploy | |
| uses: actions/deploy-pages@v4 |