34
34
with :
35
35
debug_enabled : false
36
36
37
- process-deployment :
38
- needs : debug
37
+ deploy :
39
38
if : |
40
39
(github.event_name == 'pull_request') ||
41
40
(github.event_name == 'push') ||
44
43
github.event.issue.pull_request &&
45
44
contains(github.event.comment.body, '/deploy-review-app'))
46
45
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 }}
54
46
steps :
55
47
# Initial checkout only for pull_request and push events
56
48
- name : Checkout code
@@ -178,7 +170,6 @@ jobs:
178
170
if ! cpflow exists -a ${{ env.APP_NAME }}; then
179
171
echo "APP_EXISTS=false" >> $GITHUB_ENV
180
172
else
181
- cpln workload get | tee
182
173
echo "APP_EXISTS=true" >> $GITHUB_ENV
183
174
fi
184
175
@@ -309,30 +300,12 @@ jobs:
309
300
310
301
return deployment.data.id;
311
302
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
-
330
303
- name : Update Status - Building
331
304
uses : actions/github-script@v7
332
305
with :
333
306
script : |
334
307
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 }}',
336
309
'',
337
310
'📝 [View Build Logs](${{ env.WORKFLOW_URL }})',
338
311
'',
@@ -342,7 +315,7 @@ jobs:
342
315
await github.rest.issues.updateComment({
343
316
owner: context.repo.owner,
344
317
repo: context.repo.repo,
345
- comment_id: ${{ needs.process-deployment .outputs.comment_id }},
318
+ comment_id: ${{ steps.create-comment .outputs.comment-id }},
346
319
body: buildingMessage
347
320
});
348
321
@@ -352,26 +325,15 @@ jobs:
352
325
with :
353
326
app_name : ${{ env.APP_NAME }}
354
327
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 }}
371
330
372
331
- name : Confirm Auth
373
332
run : cpln profile get
374
333
334
+ - name : Confirm Workloads
335
+ run : cpln workload get --gvc ${{ env.APP_NAME }} | tee
336
+
375
337
- name : Update Status - Deploying
376
338
uses : actions/github-script@v7
377
339
with :
@@ -389,7 +351,7 @@ jobs:
389
351
await github.rest.issues.updateComment({
390
352
owner: context.repo.owner,
391
353
repo: context.repo.repo,
392
- comment_id: ${{ needs.process-deployment .outputs.comment_id }},
354
+ comment_id: ${{ steps.create-comment .outputs.comment-id }},
393
355
body: deployingMessage
394
356
});
395
357
@@ -413,7 +375,7 @@ jobs:
413
375
const deploymentStatus = {
414
376
owner: context.repo.owner,
415
377
repo: context.repo.repo,
416
- deployment_id: ${{ needs.process -deployment.outputs.deployment_id }},
378
+ deployment_id: ${{ steps.init -deployment.outputs.result }},
417
379
state: isSuccess ? 'success' : 'failure',
418
380
environment_url: isSuccess ? appUrl : undefined,
419
381
log_url: workflowUrl,
@@ -444,6 +406,6 @@ jobs:
444
406
await github.rest.issues.updateComment({
445
407
owner: context.repo.owner,
446
408
repo: context.repo.repo,
447
- comment_id: ${{ needs.process-deployment .outputs.comment_id }},
409
+ comment_id: ${{ steps.create-comment .outputs.comment-id }},
448
410
body: isSuccess ? successMessage : failureMessage
449
411
});
0 commit comments