-
Notifications
You must be signed in to change notification settings - Fork 193
99 lines (85 loc) · 3.22 KB
/
Copy pathweb-deploy.yml
File metadata and controls
99 lines (85 loc) · 3.22 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Web Deploy (Cloudflare Workers)
on:
workflow_dispatch:
inputs:
environment:
description: "Wrangler environment (leave blank for default)"
required: false
default: ""
push:
branches: [main]
paths:
- "packages/web/**"
- ".github/workflows/web-deploy.yml"
concurrency:
group: web-deploy-${{ github.ref }}
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
environment:
name: web-production
url: https://lazycodex.ai
defaults:
run:
working-directory: packages/web
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 11.7.0
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "pnpm"
cache-dependency-path: packages/web/pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build with OpenNext for Cloudflare
run: pnpm exec opennextjs-cloudflare build
env:
NEXT_TELEMETRY_DISABLED: "1"
- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: packages/web
command: ${{ inputs.environment && format('deploy --env {0}', inputs.environment) || 'deploy' }}
- name: Post-deploy smoke checks
run: |
set -euo pipefail
echo "::group::Apex serves 200"
curl -sI https://lazycodex.ai/ | head -5
test "$(curl -s -o /dev/null -w '%{http_code}' https://lazycodex.ai/)" = "200"
echo "::endgroup::"
echo "::group::www.lazycodex.ai 301 → lazycodex.ai"
loc=$(curl -sI https://www.lazycodex.ai/ | awk -F': ' '/^[Ll]ocation:/ {print $2}' | tr -d '\r')
echo "Location: $loc"
test "$(curl -s -o /dev/null -w '%{http_code}' https://www.lazycodex.ai/)" = "301"
echo "$loc" | grep -qE '^https://lazycodex\.ai/?$'
echo "::endgroup::"
echo "::group::lazycodex.dev 301 → lazycodex.ai"
loc=$(curl -sI https://lazycodex.dev/ | awk -F': ' '/^[Ll]ocation:/ {print $2}' | tr -d '\r')
echo "Location: $loc"
test "$(curl -s -o /dev/null -w '%{http_code}' https://lazycodex.dev/)" = "301"
echo "$loc" | grep -qE '^https://lazycodex\.ai/?$'
echo "::endgroup::"
echo "::group::www.lazycodex.dev 301 → lazycodex.ai"
loc=$(curl -sI https://www.lazycodex.dev/ | awk -F': ' '/^[Ll]ocation:/ {print $2}' | tr -d '\r')
echo "Location: $loc"
test "$(curl -s -o /dev/null -w '%{http_code}' https://www.lazycodex.dev/)" = "301"
echo "$loc" | grep -qE '^https://lazycodex\.ai/?$'
echo "::endgroup::"
- name: Install Google Chrome stable
uses: browser-actions/setup-chrome@v2
with:
chrome-version: stable
- name: Live Lighthouse audits (real Chrome)
run: pnpm run test:lighthouse:live