Update Public Keys #20652
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: Update Public Keys | |
on: | |
push: | |
branches: main | |
workflow_dispatch: | |
schedule: | |
- cron: "0 * * * *" | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
extract: | |
name: Extract Cloudflare Public Keys | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: | | |
# node_modules | |
# public-keys/node_modules | |
# key: ${{ runner.os }}-cache-${{ hashFiles('**/package-lock.json') }} | |
- uses: actions/setup-node@v4 | |
if: ${{ github.event_name == 'schedule' }} | |
with: | |
node-version: "20" | |
- run: npm --prefix public-keys install | |
if: ${{ github.event_name == 'schedule' }} | |
env: | |
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" | |
- name: Extract PublicKey | |
if: ${{ github.event_name == 'schedule' }} | |
uses: mujo-code/puppeteer-headful@18.9.0 | |
with: | |
args: npm --prefix public-keys run extract | |
- name: Commit to branch | |
if: ${{ github.event_name == 'schedule' }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "Update Public Keys" | |
worker: | |
name: Update Cloudflare Worker | |
needs: extract | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: | | |
# node_modules | |
# worker/node_modules | |
# key: ${{ runner.os }}-cache-${{ hashFiles('**/package-lock.json') }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- run: npm install | |
- run: npm --prefix private-access-token.colinbendell.dev/worker install | |
- name: Update Cloudflare (private-access-token.colinbendell.dev) | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
workingDirectory: "private-access-token.colinbendell.dev/worker" | |
- run: npm --prefix private-state-token.colinbendell.dev install | |
- run: npm --prefix private-state-token.colinbendell.dev run build | |
- name: Update Cloudflare (private-state-token.colinbendell.dev) | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
projectName: "private-state-token" | |
directory: "private-state-token.colinbendell.dev/dist" | |
# Enable Wrangler v3 | |
wranglerVersion: '3' | |
pages: | |
name: Update GH Pages | |
needs: extract | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: mkdir build;cp private-access-token.colinbendell.dev/*.html build;cp src/*.js build;cp private-state-token.colinbendell.dev/index.html build/pst.html | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "build" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |