@@ -187,69 +187,40 @@ jobs:
187187 fi
188188
189189 - name : Post deployment comment
190- if : always()
190+ if : steps.check-affected.outputs.affected == 'true'
191191 uses : ./.github/actions/deployment-comment
192192 with :
193193 project-name : Website
194194 preview-url : https://pr-${{ github.event.pull_request.number }}.pgflow.pages.dev
195195 production-url : https://pgflow.dev
196+ deployment-status : ${{ steps.deploy-website.outcome }}
196197
197198 # ────────────────────────────────── 4. DEPLOY DEMO ───────────────────────────
198199 deploy-demo :
199- if : false # temporarily disabled
200+ if : github.event_name == 'pull_request'
200201 needs : [build-and-test, edge-worker-e2e]
201202 runs-on : ubuntu-latest
202- environment : ${{ github.event_name == 'pull_request' && 'preview' || 'production' }}
203+ environment : preview
204+ # environment: ${{ github.event_name == 'pull_request' && 'preview' || 'production' }}
203205 env :
204206 NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
205207 CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
206208 CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
207- VITE_SUPABASE_URL : ${{ github.event_name == 'pull_request' && secrets.DEMO_PREVIEW_SUPABASE_URL || secrets.DEMO_PRODUCTION_SUPABASE_URL }}
208- VITE_SUPABASE_ANON_KEY : ${{ github.event_name == 'pull_request' && secrets.DEMO_PREVIEW_SUPABASE_ANON_KEY || secrets.DEMO_PRODUCTION_SUPABASE_ANON_KEY }}
209+ VITE_SUPABASE_URL : ${{ secrets.DEMO_PREVIEW_SUPABASE_URL }}
210+ # VITE_SUPABASE_URL: ${{ github.event_name == 'pull_request' && secrets.DEMO_PREVIEW_SUPABASE_URL || secrets.DEMO_PRODUCTION_SUPABASE_URL }}
211+ VITE_SUPABASE_ANON_KEY : ${{ secrets.DEMO_PREVIEW_SUPABASE_ANON_KEY }}
212+ # VITE_SUPABASE_ANON_KEY: ${{ github.event_name == 'pull_request' && secrets.DEMO_PREVIEW_SUPABASE_ANON_KEY || secrets.DEMO_PRODUCTION_SUPABASE_ANON_KEY }}
213+ PREVIEW_NAME : pr-${{ github.event.pull_request.number }}
209214 steps :
210215 - uses : actions/checkout@v4
211216 with :
212217 fetch-depth : 0
213218
214219 - uses : ./.github/actions/setup
215220
216- - name : Set Nx base for affected commands
217- run : |
218- echo "NX_BASE=origin/main" >> $GITHUB_ENV
219- echo "NX_HEAD=HEAD" >> $GITHUB_ENV
220-
221- - name : Verify NX_BASE and NX_HEAD are set
222- run : echo "BASE=$NX_BASE HEAD=$NX_HEAD"
223-
224- - name : Validate Supabase environment variables
225- run : |
226- if [ -z "$VITE_SUPABASE_URL" ]; then
227- echo "❌ Error: VITE_SUPABASE_URL is not set"
228- echo "Required GitHub secret missing: DEMO_${{ github.event_name == 'pull_request' && 'PREVIEW' || 'PRODUCTION' }}_SUPABASE_URL"
229- exit 1
230- fi
231- if [ -z "$VITE_SUPABASE_ANON_KEY" ]; then
232- echo "❌ Error: VITE_SUPABASE_ANON_KEY is not set"
233- echo "Required GitHub secret missing: DEMO_${{ github.event_name == 'pull_request' && 'PREVIEW' || 'PRODUCTION' }}_SUPABASE_ANON_KEY"
234- exit 1
235- fi
236- if [[ ! "$VITE_SUPABASE_URL" =~ ^https:// ]]; then
237- echo "❌ Error: VITE_SUPABASE_URL must use https:// (not http://)"
238- echo "Current value: $VITE_SUPABASE_URL"
239- exit 1
240- fi
241- echo "✅ Supabase environment variables are valid"
242-
243- - name : Deploy demo
221+ - name : Deploy demo preview
244222 id : deploy-demo
245- env :
246- PREVIEW_NAME : pr-${{ github.event.pull_request.number }}
247- run : |
248- if [[ "${{ github.event_name }}" == "pull_request" ]]; then
249- pnpm nx affected -t deploy:preview --projects=demo --base="$NX_BASE" --head="$NX_HEAD"
250- else
251- pnpm nx affected -t deploy --projects=demo --base="$NX_BASE" --head="$NX_HEAD"
252- fi
223+ run : pnpm nx affected -t deploy:preview --base=origin/main --head=HEAD
253224
254225 - name : Post deployment comment
255226 if : success()
@@ -258,3 +229,4 @@ jobs:
258229 project-name : Demo
259230 preview-url : https://pr-${{ github.event.pull_request.number }}-pgflow-demo.jumski.workers.dev
260231 production-url : https://demo.pgflow.dev
232+ deployment-status : ${{ steps.deploy-demo.outcome }}
0 commit comments