Delete package-lock.json #159
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 static site to GitHub Pages | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Inject application secrets | |
| run: | | |
| node - <<'NODE' | |
| const fs = require('fs'); | |
| const path = 'index.html'; | |
| const html = fs.readFileSync(path, 'utf8'); | |
| const config = { | |
| twilioAccountSid: process.env.TWILIO_ACCOUNT_SID || '', | |
| twilioAuthToken: process.env.TWILIO_AUTH_TOKEN || '', | |
| twilioPhoneNumber: process.env.TWILIO_PHONE_NUMBER || '', | |
| pollinationsToken: process.env.POLLINATIONS_TOKEN || '', | |
| pollinationsReferrer: process.env.POLLINATIONS_REFERRER || '', | |
| twilioStatusCallback: process.env.TWILIO_STATUS_CALLBACK || '', | |
| twilioStatusEvents: process.env.TWILIO_STATUS_EVENTS || '' | |
| }; | |
| const script = `<script id="app-config">window.__APP_CONFIG__ = ${JSON.stringify(config)};</script>`; | |
| const updated = html.replace(/<script id="app-config">[\s\S]*?<\/script>/, script); | |
| if (updated === html) { | |
| throw new Error('Failed to locate <script id="app-config"> placeholder'); | |
| } | |
| fs.writeFileSync(path, updated); | |
| NODE | |
| env: | |
| TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }} | |
| TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }} | |
| TWILIO_PHONE_NUMBER: ${{ secrets.TWILIO_PHONE_NUMBER }} | |
| POLLINATIONS_TOKEN: ${{ secrets.POLLINATIONS_TOKEN }} | |
| POLLINATIONS_REFERRER: ${{ secrets.POLLINATIONS_REFERRER }} | |
| TWILIO_STATUS_CALLBACK: ${{ secrets.TWILIO_STATUS_CALLBACK }} | |
| TWILIO_STATUS_EVENTS: ${{ secrets.TWILIO_STATUS_EVENTS }} | |
| - name: Run application verification tests | |
| run: npm test | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: . | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |