3434 with :
3535 debug_enabled : false
3636
37- process-deployment :
38- needs : debug
37+ deploy :
3938 if : |
4039 (github.event_name == 'pull_request') ||
4140 (github.event_name == 'push') ||
4443 github.event.issue.pull_request &&
4544 contains(github.event.comment.body, '/deploy-review-app'))
4645 runs-on : ubuntu-latest
47- outputs :
48- pr_number : ${{ env.PR_NUMBER }}
49- pr_sha : ${{ env.PR_SHA }}
50- pr_ref : ${{ steps.getRef.outputs.PR_REF }}
51- do_deploy : ${{ env.DO_DEPLOY }}
52- comment_id : ${{ steps.create-comment.outputs.comment-id }}
53- deployment_id : ${{ steps.init-deployment.outputs.result }}
5446 steps :
5547 # Initial checkout only for pull_request and push events
5648 - name : Checkout code
@@ -178,7 +170,6 @@ jobs:
178170 if ! cpflow exists -a ${{ env.APP_NAME }}; then
179171 echo "APP_EXISTS=false" >> $GITHUB_ENV
180172 else
181- cpln workload get | tee
182173 echo "APP_EXISTS=true" >> $GITHUB_ENV
183174 fi
184175
@@ -309,30 +300,12 @@ jobs:
309300
310301 return deployment.data.id;
311302
312- build :
313- needs : process-deployment
314- if : needs.process-deployment.outputs.do_deploy != 'false'
315- runs-on : ubuntu-latest
316- outputs :
317- image_tag : ${{ steps.build.outputs.image_tag }}
318- steps :
319- - name : Checkout code
320- uses : actions/checkout@v4
321- with :
322- ref : ${{ needs.process-deployment.outputs.pr_ref }}
323-
324- - name : Setup Environment
325- uses : ./.github/actions/setup-environment
326- with :
327- token : ${{ secrets.CPLN_TOKEN_STAGING }}
328- org : ${{ vars.CPLN_ORG_STAGING }}
329-
330303 - name : Update Status - Building
331304 uses : actions/github-script@v7
332305 with :
333306 script : |
334307 const buildingMessage = [
335- '🏗️ Building Docker image for PR #${{ needs.process-deployment.outputs.pr_number }}, commit ${{ needs.process-deployment.outputs.pr_sha }}',
308+ '🏗️ Building Docker image for PR #${{ env.PR_NUMBER }}, commit ${{ env.PR_SHA }}',
336309 '',
337310 '📝 [View Build Logs](${{ env.WORKFLOW_URL }})',
338311 '',
@@ -342,7 +315,7 @@ jobs:
342315 await github.rest.issues.updateComment({
343316 owner: context.repo.owner,
344317 repo: context.repo.repo,
345- comment_id: ${{ needs.process-deployment .outputs.comment_id }},
318+ comment_id: ${{ steps.create-comment .outputs.comment-id }},
346319 body: buildingMessage
347320 });
348321
@@ -352,26 +325,15 @@ jobs:
352325 with :
353326 app_name : ${{ env.APP_NAME }}
354327 org : ${{ vars.CPLN_ORG_STAGING }}
355- commit : ${{ needs.process-deployment.outputs.pr_sha }}
356- PR_NUMBER : ${{ needs.process-deployment.outputs.pr_number }}
357-
358- deploy :
359- needs : [build, process-deployment]
360- if : needs.build.outputs.do_deploy != 'false'
361- runs-on : ubuntu-latest
362- steps :
363- - name : Checkout code
364- uses : actions/checkout@v4
365-
366- - name : Setup Environment
367- uses : ./.github/actions/setup-environment
368- with :
369- token : ${{ secrets.CPLN_TOKEN_STAGING }}
370- org : ${{ vars.CPLN_ORG_STAGING }}
328+ commit : ${{ env.PR_SHA }}
329+ PR_NUMBER : ${{ env.PR_NUMBER }}
371330
372331 - name : Confirm Auth
373332 run : cpln profile get
374333
334+ - name : Confirm Workloads
335+ run : cpln workload get --gvc ${{ env.APP_NAME }} | tee
336+
375337 - name : Update Status - Deploying
376338 uses : actions/github-script@v7
377339 with :
@@ -389,7 +351,7 @@ jobs:
389351 await github.rest.issues.updateComment({
390352 owner: context.repo.owner,
391353 repo: context.repo.repo,
392- comment_id: ${{ needs.process-deployment .outputs.comment_id }},
354+ comment_id: ${{ steps.create-comment .outputs.comment-id }},
393355 body: deployingMessage
394356 });
395357
@@ -413,7 +375,7 @@ jobs:
413375 const deploymentStatus = {
414376 owner: context.repo.owner,
415377 repo: context.repo.repo,
416- deployment_id: ${{ needs.process -deployment.outputs.deployment_id }},
378+ deployment_id: ${{ steps.init -deployment.outputs.result }},
417379 state: isSuccess ? 'success' : 'failure',
418380 environment_url: isSuccess ? appUrl : undefined,
419381 log_url: workflowUrl,
@@ -444,6 +406,6 @@ jobs:
444406 await github.rest.issues.updateComment({
445407 owner: context.repo.owner,
446408 repo: context.repo.repo,
447- comment_id: ${{ needs.process-deployment .outputs.comment_id }},
409+ comment_id: ${{ steps.create-comment .outputs.comment-id }},
448410 body: isSuccess ? successMessage : failureMessage
449411 });
0 commit comments