mirror of
https://github.com/lbr77/SideImpactor.git
synced 2026-08-05 14:55:22 -04:00
feat: add GitHub Actions workflow for automatic Cloudflare Worker deployment
This commit is contained in:
44
.github/workflows/deploy-workers.yml
vendored
Normal file
44
.github/workflows/deploy-workers.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
name: Deploy Cloudflare Worker
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: deploy-cloudflare-worker
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Set up Bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version-file: package.json
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun install --frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
|
- name: Build frontend
|
||||||
|
run: bun run build:frontend
|
||||||
|
|
||||||
|
- name: Deploy Worker
|
||||||
|
uses: cloudflare/wrangler-action@v4
|
||||||
|
with:
|
||||||
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
|
command: deploy
|
||||||
|
packageManager: bun
|
||||||
|
workingDirectory: backend
|
||||||
@@ -52,6 +52,20 @@ cd backend
|
|||||||
bun run deploy
|
bun run deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Pushes to `main` deploy automatically to the Worker's `workers.dev` URL through
|
||||||
|
`.github/workflows/deploy-workers.yml`.
|
||||||
|
|
||||||
|
Configure these repository secrets under **Settings → Secrets and variables →
|
||||||
|
Actions**:
|
||||||
|
|
||||||
|
- `CLOUDFLARE_API_TOKEN`: a Cloudflare API token with `Workers Scripts: Edit`,
|
||||||
|
scoped to the deployment account
|
||||||
|
- `CLOUDFLARE_ACCOUNT_ID`: the target Cloudflare account ID
|
||||||
|
|
||||||
|
Create the token from the Cloudflare dashboard's **Manage Account → Account API
|
||||||
|
Tokens** page. Find the account ID on the target account's Cloudflare dashboard
|
||||||
|
overview page.
|
||||||
|
|
||||||
## Optional auth
|
## Optional auth
|
||||||
|
|
||||||
Set one of these as Worker secrets:
|
Set one of these as Worker secrets:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"$schema": "./node_modules/wrangler/config-schema.json",
|
"$schema": "./node_modules/wrangler/config-schema.json",
|
||||||
"name": "webmuxd-wisp-demo",
|
"name": "webmuxd-wisp-demo",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
|
"workers_dev": true,
|
||||||
"compatibility_date": "2026-03-03",
|
"compatibility_date": "2026-03-03",
|
||||||
"assets": {
|
"assets": {
|
||||||
"directory": "../frontend/dist",
|
"directory": "../frontend/dist",
|
||||||
|
|||||||
Reference in New Issue
Block a user