Formatted code #9
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 ] # or your default branch | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| # If you prefer environment secrets, uncomment the next line and add secrets to that env: | |
| # environment: github-pages | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build static site | |
| run: | | |
| mkdir -p dist | |
| # copy everything except git/meta and any local env.js | |
| rsync -av --delete \ | |
| --exclude ".git*" \ | |
| --exclude ".github" \ | |
| --exclude "env.js" \ | |
| ./ dist/ | |
| - name: Generate env.js from secrets | |
| run: | | |
| cat > dist/env.js << 'EOF' | |
| window.__FIREBASE_CONFIG = { | |
| apiKey: "${{ secrets.FIREBASE_API_KEY }}", | |
| authDomain: "${{ secrets.FIREBASE_AUTH_DOMAIN }}", | |
| projectId: "${{ secrets.FIREBASE_PROJECT_ID }}", | |
| storageBucket: "${{ secrets.FIREBASE_STORAGE_BUCKET }}", | |
| messagingSenderId: "${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}", | |
| appId: "${{ secrets.FIREBASE_APP_ID }}", | |
| measurementId: "${{ secrets.FIREBASE_MEASUREMENT_ID }}" | |
| }; | |
| // Optional: only if you enable App Check later | |
| window.__RECAPTCHA_V3_SITE_KEY = "${{ secrets.RECAPTCHA_V3_SITE_KEY }}"; | |
| EOF | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: dist | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |