35 lines
880 B
YAML
35 lines
880 B
YAML
name: Deploy Worker
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main # or 'production' depending on your branch name
|
|
workflow_dispatch: # Allows manual triggering from GitHub UI
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
name: Deploy Worker
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
|
|
- name: Install Dependencies
|
|
run: npm ci
|
|
working-directory: ./worker
|
|
|
|
- name: Deploy to Cloudflare Workers
|
|
run: |
|
|
npm install -g wrangler@3.107.3
|
|
# Uses default wrangler.toml (production config)
|
|
wrangler deploy
|
|
working-directory: ./worker
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|