Fetch Data and Deploy #294
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 and Deploy | |
| on: | |
| # Run on schedule (every 6 hours) | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| # Run on push to main (for initial setup) | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| fetch-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Fetch data | |
| env: | |
| # Google Analytics | |
| GA_PROPERTY_ID: ${{ secrets.GA_PROPERTY_ID }} | |
| GOOGLE_SERVICE_ACCOUNT_KEY: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }} | |
| # Jira | |
| JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | |
| JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }} | |
| JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | |
| JIRA_PROJECT_KEY: ${{ secrets.JIRA_PROJECT_KEY }} | |
| # OpenAI | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| # Algolia | |
| ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} | |
| ALGOLIA_ANALYTICS_API_KEY: ${{ secrets.ALGOLIA_ANALYTICS_API_KEY }} | |
| ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }} | |
| run: npm run fetch-data | |
| - name: Create config file with secrets | |
| run: | | |
| echo "export const SITE_PASSWORD = '${{ secrets.SITE_PASS }}';" > src/config.js | |
| - name: Build dashboard | |
| run: npm run build | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./dist | |
| cname: # Add your custom domain here if you have one |