Skip to content

Commit ccf433d

Browse files
committed
Fix CI workflows
1 parent 605a7cc commit ccf433d

5 files changed

Lines changed: 114 additions & 25 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Setup
2+
description: Setup Node.js, pnpm, and install dependencies
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup pnpm
8+
uses: pnpm/action-setup@v4
9+
10+
- name: Setup Node
11+
uses: actions/setup-node@v4
12+
with:
13+
node-version: "22"
14+
cache: "pnpm"
15+
16+
- name: Install Dependencies
17+
shell: bash
18+
run: pnpm install --frozen-lockfile

.github/workflows/ci.yml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,8 @@ jobs:
1414
- name: Checkout
1515
uses: actions/checkout@v4
1616

17-
- name: Setup pnpm
18-
uses: pnpm/action-setup@v4
19-
20-
- name: Setup Node
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: "22"
24-
cache: "pnpm"
25-
26-
- name: Install Dependencies
27-
run: pnpm install --frozen-lockfile
17+
- name: Setup
18+
uses: ./.github/actions/setup
2819

2920
- name: Setup Environment
3021
run: cp .env.dist .env
@@ -49,13 +40,8 @@ jobs:
4940
- name: Checkout
5041
uses: actions/checkout@v4
5142

52-
- name: Setup pnpm
53-
uses: pnpm/action-setup@v4
54-
55-
- name: Setup Node
56-
uses: actions/setup-node@v4
57-
with:
58-
node-version: "22"
43+
- name: Setup
44+
uses: ./.github/actions/setup
5945

6046
- name: Download Build Artifacts
6147
uses: actions/download-artifact@v4
@@ -73,13 +59,8 @@ jobs:
7359
- name: Checkout
7460
uses: actions/checkout@v4
7561

76-
- name: Setup pnpm
77-
uses: pnpm/action-setup@v4
78-
79-
- name: Setup Node
80-
uses: actions/setup-node@v4
81-
with:
82-
node-version: "22"
62+
- name: Setup
63+
uses: ./.github/actions/setup
8364

8465
- name: Download Build Artifacts
8566
uses: actions/download-artifact@v4
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Deploy Production
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: "Branch or tag to deploy (leave empty for default branch)"
8+
required: false
9+
type: string
10+
default: ""
11+
12+
jobs:
13+
deploy:
14+
uses: ./.github/workflows/wrangler-deploy.yml
15+
with:
16+
environment: production
17+
site_url: https://johnhooks.io
18+
ref: ${{ inputs.ref }}
19+
secrets:
20+
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
21+
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Deploy Staging
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: "Branch or tag to deploy (leave empty for default branch)"
8+
required: false
9+
type: string
10+
default: ""
11+
12+
jobs:
13+
deploy:
14+
uses: ./.github/workflows/wrangler-deploy.yml
15+
with:
16+
environment: staging
17+
site_url: https://website-staging.johnhooks.workers.dev
18+
ref: ${{ inputs.ref }}
19+
secrets:
20+
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
21+
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Reusable Workflow - Wrangler Deploy
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
required: true
8+
type: string
9+
description: Environment to deploy (production or staging)
10+
site_url:
11+
required: true
12+
type: string
13+
description: Site URL for build
14+
ref:
15+
required: false
16+
type: string
17+
description: Git ref to deploy
18+
default: ""
19+
secrets:
20+
cloudflare_api_token:
21+
required: true
22+
cloudflare_account_id:
23+
required: true
24+
25+
jobs:
26+
deploy:
27+
runs-on: ubuntu-latest
28+
environment: ${{ inputs.environment }}
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ inputs.ref || github.ref }}
35+
36+
- name: Setup
37+
uses: ./.github/actions/setup
38+
39+
- name: Build
40+
run: pnpm build
41+
env:
42+
SITE_URL: ${{ inputs.site_url }}
43+
44+
- name: Deploy to Cloudflare
45+
run: pnpm wrangler deploy --env ${{ inputs.environment }}
46+
env:
47+
CLOUDFLARE_API_TOKEN: ${{ secrets.cloudflare_api_token }}
48+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.cloudflare_account_id }}

0 commit comments

Comments
 (0)