1
- name : Deploy Frontend to Vercel
1
+ name : Deploy Frontend to Cloudflare Pages
2
2
3
3
on :
4
4
push :
22
22
runs-on : ubuntu-latest
23
23
name : Deploy Frontend to Staging
24
24
environment : staging
25
+ env :
26
+ CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
27
+ CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
25
28
steps :
26
29
- name : Checkout
27
30
uses : actions/checkout@v4
@@ -33,24 +36,31 @@ jobs:
33
36
cache : ' npm'
34
37
cache-dependency-path : frontend/package-lock.json
35
38
39
+ - name : " Preflight: verify Cloudflare secrets (staging)"
40
+ run : |
41
+ if [ -z "${CLOUDFLARE_API_TOKEN}" ] || [ -z "${CLOUDFLARE_ACCOUNT_ID}" ]; then
42
+ echo "::error::Missing Cloudflare secrets. Ensure CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID are set in repository or environment secrets."
43
+ exit 1
44
+ fi
45
+
36
46
- name : Install frontend dependencies
37
47
run : npm ci
38
48
working-directory : frontend
39
49
40
- - name : Build frontend
50
+ - name : Build frontend for Cloudflare Pages
41
51
run : npm run build
42
52
working-directory : frontend
43
53
env :
44
54
NODE_ENV : production
45
55
46
- - name : Deploy to Vercel (Staging)
47
- uses : amondnet/vercel -action@v25
56
+ - name : Deploy to Cloudflare Pages (Staging)
57
+ uses : cloudflare/pages -action@v1
48
58
with :
49
- vercel-token : ${{ secrets.VERCEL_TOKEN }}
50
- vercel-org-id : ${{ secrets.VERCEL_ORG_ID }}
51
- vercel-project-id : ${{ secrets.VERCEL_PROJECT_ID }}
52
- working- directory : frontend
53
- scope : ${{ secrets.VERCEL_ORG_ID }}
59
+ apiToken : ${{ env.CLOUDFLARE_API_TOKEN }}
60
+ accountId : ${{ env.CLOUDFLARE_ACCOUNT_ID }}
61
+ projectName : supabase-configurator-staging
62
+ directory : frontend/out
63
+ gitHubToken : ${{ secrets.GITHUB_TOKEN }}
54
64
55
65
- name : Comment PR with staging URL
56
66
if : github.event_name == 'pull_request'
61
71
issue_number: context.issue.number,
62
72
owner: context.repo.owner,
63
73
repo: context.repo.repo,
64
- body: '🚀 Frontend staging deployment complete!\\n\\n**Preview URL:** Available in Vercel deployment logs \\n\\nTest your changes before merging to production.'
74
+ body: '🚀 Frontend staging deployment complete!\\n\\n**Preview URL:** https://supabase-configurator-staging.pages.dev \\n\\nTest your changes before merging to production.'
65
75
})
66
76
67
77
# Deploy to production on main branch
70
80
runs-on : ubuntu-latest
71
81
name : Deploy Frontend to Production
72
82
environment : production
83
+ env :
84
+ CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
85
+ CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
73
86
steps :
74
87
- name : Checkout
75
88
uses : actions/checkout@v4
81
94
cache : ' npm'
82
95
cache-dependency-path : frontend/package-lock.json
83
96
97
+ - name : " Preflight: verify Cloudflare secrets (production)"
98
+ run : |
99
+ if [ -z "${CLOUDFLARE_API_TOKEN}" ] || [ -z "${CLOUDFLARE_ACCOUNT_ID}" ]; then
100
+ echo "::error::Missing Cloudflare secrets. Ensure CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID are set in repository or environment secrets."
101
+ exit 1
102
+ fi
103
+
84
104
- name : Install frontend dependencies
85
105
run : npm ci
86
106
working-directory : frontend
@@ -89,35 +109,35 @@ jobs:
89
109
run : npm run typecheck
90
110
working-directory : frontend
91
111
92
- - name : Run linting
112
+ - name : Run linting
93
113
run : npm run lint
94
114
working-directory : frontend
95
115
96
- - name : Build frontend
116
+ - name : Build frontend for Cloudflare Pages
97
117
run : npm run build
98
118
working-directory : frontend
99
119
env :
100
120
NODE_ENV : production
101
121
102
- - name : Deploy to Vercel (Production)
122
+ - name : Deploy to Cloudflare Pages (Production)
103
123
id : deploy
104
- uses : amondnet/vercel -action@v25
124
+ uses : cloudflare/pages -action@v1
105
125
with :
106
- vercel-token : ${{ secrets.VERCEL_TOKEN }}
107
- vercel-org-id : ${{ secrets.VERCEL_ORG_ID }}
108
- vercel-project-id : ${{ secrets.VERCEL_PROJECT_ID }}
109
- vercel-args : ' --prod'
110
- working-directory : frontend
111
- scope : ${{ secrets.VERCEL_ORG_ID }}
126
+ apiToken : ${{ env.CLOUDFLARE_API_TOKEN }}
127
+ accountId : ${{ env.CLOUDFLARE_ACCOUNT_ID }}
128
+ projectName : supabase-configurator
129
+ directory : frontend/out
130
+ gitHubToken : ${{ secrets.GITHUB_TOKEN }}
112
131
113
132
- name : Show deployment URL
114
133
run : |
115
- echo "🚀 Frontend deployed successfully to Vercel!"
116
- echo "📍 Production URL: https://supabase-configurator.vercel.app (or your custom domain)"
134
+ echo "🚀 Frontend deployed successfully to Cloudflare Pages!"
135
+ echo "📍 Production URL: https://supabase-configurator.pages.dev"
136
+ echo "📍 Custom domain can be configured in Cloudflare Pages dashboard"
117
137
echo ""
118
138
echo "🔧 Next steps:"
119
- echo " 1. Configure custom domain in Vercel dashboard"
120
- echo " 2. Update DNS records if using custom domain "
139
+ echo " 1. Configure custom domain in Cloudflare Pages dashboard"
140
+ echo " 2. Update DNS records to point to Cloudflare Pages "
121
141
echo " 3. Enable Lighthouse testing with confirmed URL"
122
142
123
143
# Health check after deployment
@@ -128,20 +148,20 @@ jobs:
128
148
name : Production Health Check
129
149
steps :
130
150
- name : Wait for deployment
131
- run : sleep 30
151
+ run : sleep 45
132
152
133
153
- name : Health Check
134
154
run : |
135
155
echo "Checking production health..."
136
- # Test the deployment - update with your actual Vercel URL
137
- URL="https://supabase-configurator.vercel.app "
156
+ # Test the Cloudflare Pages deployment
157
+ URL="https://supabase-configurator.pages.dev "
138
158
139
159
if curl -f -s --max-time 10 "$URL" > /dev/null; then
140
160
echo "✅ Frontend is accessible at $URL"
141
161
else
142
162
echo "❌ Frontend health check failed"
143
163
echo "🔍 Manual check required at $URL"
144
- # Don't fail the workflow since URL might be different
164
+ # Don't fail workflow since URL might be different initially
145
165
fi
146
166
147
167
- name : Notify on failure
@@ -156,7 +176,7 @@ jobs:
156
176
body: `Production frontend deployment failed for commit ${context.sha}.\\n\\nPlease investigate immediately.\\n\\n**Commit:** ${context.sha}\\n**Workflow:** ${context.workflow}\\n**Run:** ${context.runId}`
157
177
})
158
178
159
- # Optional: Lighthouse performance test
179
+ # Lighthouse performance test
160
180
lighthouse :
161
181
needs : [deploy-production]
162
182
if : false # Enable once URL is confirmed: github.ref == 'refs/heads/main' && github.event_name == 'push'
@@ -167,13 +187,13 @@ jobs:
167
187
uses : actions/checkout@v4
168
188
169
189
- name : Wait for deployment
170
- run : sleep 45
190
+ run : sleep 60
171
191
172
192
- name : Lighthouse CI
173
193
uses : treosh/lighthouse-ci-action@v10
174
194
with :
175
195
urls : |
176
- https://supabase-configurator.vercel.app
196
+ https://supabase-configurator.pages.dev
177
197
configPath : ' ./.lighthouserc.json'
178
198
uploadArtifacts : true
179
199
temporaryPublicStorage : true
0 commit comments