Skip to content

Commit 479f74a

Browse files
authored
ci: use frozen-lockfile and pnpm exec wrangler (#123)
1 parent 45e5887 commit 479f74a

1 file changed

Lines changed: 42 additions & 52 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 42 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy
1+
name: Deploy
22

33
on:
44
push:
@@ -15,57 +15,75 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
ci:
18+
lint:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v4
2222

23-
- name: Set up pnpm
24-
uses: pnpm/action-setup@v4
23+
- uses: pnpm/action-setup@v4
2524
with:
2625
version: 10
2726

28-
- name: Setup Node.js
29-
uses: actions/setup-node@v4
27+
- uses: actions/setup-node@v4
3028
with:
3129
node-version: "24"
30+
cache: "pnpm"
3231

33-
- name: Install dependencies
34-
run: pnpm install
32+
- run: pnpm install --frozen-lockfile
3533

3634
- name: Check code
3735
run: pnpm check
3836

3937
- name: Check types
4038
run: pnpm check:types
4139

40+
test:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- uses: pnpm/action-setup@v4
46+
with:
47+
version: 10
48+
49+
- uses: actions/setup-node@v4
50+
with:
51+
node-version: "24"
52+
cache: "pnpm"
53+
54+
- run: pnpm install --frozen-lockfile
55+
4256
- name: Tests
4357
run: pnpm test
4458

59+
build-and-deploy:
60+
needs: [lint, test]
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- uses: pnpm/action-setup@v4
66+
with:
67+
version: 10
68+
69+
- uses: actions/setup-node@v4
70+
with:
71+
node-version: "24"
72+
cache: "pnpm"
73+
74+
- run: pnpm install --frozen-lockfile
75+
4576
- name: Build
4677
run: pnpm build
4778
env:
4879
SPEC_PAT: ${{ secrets.SPEC_PAT }}
4980

5081
- name: Smoke test (wrangler dev)
5182
run: |
52-
# ──────────────────────────────────────────────────────────
53-
# To reproduce locally:
54-
# pnpm build
55-
# pnpm wrangler:dev &
56-
# curl -s -o /dev/null -w '%{http_code}' http://localhost:8788/quickstart/tempoctl -H 'Accept: text/html'
57-
# curl -s -o /dev/null -w '%{http_code}' http://localhost:8788/ -H 'Accept: text/html'
58-
# curl -s -o /dev/null -w '%{http_code}' http://localhost:8788/ -H 'Accept: text/markdown'
59-
# All three should return 200. If any return 500, check wrangler
60-
# logs for the error — usually a missing module or unsupported
61-
# Node.js API. Fix in scripts/patch-cf.ts.
62-
# ──────────────────────────────────────────────────────────
63-
6483
WRANGLER_LOG=$(mktemp)
65-
npx wrangler dev --port 8788 > "$WRANGLER_LOG" 2>&1 &
84+
pnpm exec wrangler dev --port 8788 > "$WRANGLER_LOG" 2>&1 &
6685
WRANGLER_PID=$!
6786
68-
# Wait for wrangler to be ready (up to 30s)
6987
for i in $(seq 1 30); do
7088
if curl -sf http://localhost:8788/ -o /dev/null 2>/dev/null; then
7189
break
@@ -115,34 +133,6 @@ jobs:
115133
- name: Prune server bundle
116134
run: node --experimental-strip-types scripts/prune-server.ts
117135

118-
- name: Upload build
119-
uses: actions/upload-artifact@v4
120-
with:
121-
name: dist
122-
path: dist/
123-
124-
deploy:
125-
needs: ci
126-
runs-on: ubuntu-latest
127-
steps:
128-
- uses: actions/checkout@v4
129-
130-
- name: Set up pnpm
131-
uses: pnpm/action-setup@v4
132-
with:
133-
version: 10
134-
135-
- name: Setup Node.js
136-
uses: actions/setup-node@v4
137-
with:
138-
node-version: "22"
139-
140-
- name: Download build
141-
uses: actions/download-artifact@v4
142-
with:
143-
name: dist
144-
path: dist/
145-
146136
- name: Sanitize branch name
147137
if: github.event_name == 'pull_request'
148138
id: branch
@@ -166,15 +156,15 @@ jobs:
166156
script: |
167157
const alias = "${{ steps.branch.outputs.alias }}"
168158
const url = `https://${alias}-mpp-docs.porto.workers.dev`
169-
const body = `MPP Docs preview: ${url}`
159+
const body = `docs preview: ${url}`
170160
const { data: comments } = await github.rest.issues.listComments({
171161
issue_number: context.issue.number,
172162
owner: context.repo.owner,
173163
repo: context.repo.repo,
174164
})
175165
let existing = null
176166
for (const comment of comments) {
177-
if (comment.body && comment.body.startsWith('MPP Docs preview:')) {
167+
if (comment.body && comment.body.startsWith('docs preview:')) {
178168
existing = comment
179169
break
180170
}

0 commit comments

Comments
 (0)