-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.67 KB
/
Copy pathdeploy.yml
File metadata and controls
55 lines (51 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Deploys the Worker and the app to Cloudflare on every push to the default
# branch that touches something deployable. Needs two repository secrets:
# CLOUDFLARE_API_TOKEN an API token with the "Edit Cloudflare Workers" template
# CLOUDFLARE_ACCOUNT_ID the account that owns the Worker
name: deploy
on:
push:
branches: [main]
paths:
- "worker/**"
- "shared/**"
- "web/**"
- "data/**"
- "schemas/**"
- "index.html"
- "vite.config.ts"
- "wrangler.jsonc"
- "package.json"
- "package-lock.json"
- ".github/workflows/deploy.yml"
workflow_dispatch:
concurrency:
group: deploy
cancel-in-progress: true
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm test
- run: npm run check
- run: npx vite build
# The action runs every line of `command` as its own wrangler call, so
# only the commit subject may go into the message, and never a quote.
- id: commit
run: echo "subject=$(git log -1 --pretty=%s | tr -d '"')" >> "$GITHUB_OUTPUT"
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# Shown in the dashboard's version list: which commit, and which workflow run shipped it.
command: >-
deploy --tag "${{ github.sha }}"
--message "${{ github.workflow }} #${{ github.run_number }}: ${{ steps.commit.outputs.subject }}"