# This is a combination of 3 commits.
# This is the 1st commit message: fix: redirects + update root cdn url # This is the commit message #2: chore: workflow # This is the commit message #3: chore: naming
This commit is contained in:
parent
ed88631875
commit
88a4ec4acd
45 changed files with 1122 additions and 133 deletions
45
.github/workflows/deploy-worker.yaml
vendored
Normal file
45
.github/workflows/deploy-worker.yaml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
name: Deploy Cloudflare Worker
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
worker-folder:
|
||||
description: 'Select the folder containing the worker to deploy'
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- analytics
|
||||
- contact
|
||||
- now-playing
|
||||
- rebuild
|
||||
- scrobble
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Install Wrangler
|
||||
run: npm install -g wrangler
|
||||
|
||||
- name: Inject environment variables into wrangler.toml
|
||||
run: |
|
||||
cd workers/${{ github.event.inputs.worker-folder }}
|
||||
sed -i 's/^zone_id =.*/zone_id = "${{ secrets.CLOUDFLARE_ZONE_ID }}"/' wrangler.toml
|
||||
sed -i 's/^account_id =.*/account_id = "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}"/' wrangler.toml
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
cd workers/${{ github.event.inputs.worker-folder }}
|
||||
npm i
|
||||
|
||||
- name: Deploy to Cloudflare Worker
|
||||
run: |
|
||||
cd workers/${{ github.event.inputs.worker-folder }}
|
||||
wrangler deploy --env production
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
Reference in a new issue