Updated with Dev Metrics #575
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 # Change if needed | |
| workflow_dispatch: # Allow manual triggering from the Actions tab | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Single job to build and deploy | |
| jobs: | |
| build-and-deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Inject GEMINI_API_KEY into JS file | |
| run: | | |
| echo "Injecting API key into script.js" | |
| sed -i "s|const API_KEY = \"\";|const API_KEY = \"${{ secrets.GEMINI_API_KEY }}\";|g" script.js | |
| grep -q "const API_KEY = \"${{ secrets.GEMINI_API_KEY }}\"" script.js && echo "API key injection successful" || { echo "API key injection failed"; exit 1; } | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact for deployment | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: . # Deploy the root directory | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |