Generate Dashboard #20
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: Generate Dashboard | |
| on: | |
| schedule: | |
| - cron: '0 5 * * *' | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'data/**' | |
| - 'config.yml' | |
| jobs: | |
| dashboard: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Checkout dashboard repo (for scripts) | |
| uses: actions/checkout@v4 | |
| with: | |
| path: dashboard | |
| - name: Checkout metrics vault (for data) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.repository_owner }}/metrics-vault | |
| token: ${{ secrets.METRICS_VAULT_TOKEN }} | |
| path: vault | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.3' | |
| bundler-cache: true | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgd-dev pkg-config | |
| - name: Install gems | |
| run: bundle install | |
| working-directory: dashboard | |
| - name: Generate dashboard | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| run: | | |
| # Create symlink or copy data from vault to dashboard | |
| mkdir -p dashboard/data | |
| cp -r vault/data/raw dashboard/data/raw | |
| cd dashboard | |
| ruby scripts/generate_dashboard.rb | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: dashboard/output/dashboard | |
| - name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v4 |