Skip to content

Commit e43fa3e

Browse files
committed
perf: use deployment_status input for k8s_release
1 parent abf32eb commit e43fa3e

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.github/workflows/gh_release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: 'GitHub: Release'
22

33
on:
44
workflow_call:
5+
inputs:
6+
deployment_status:
7+
required: true
8+
type: string
59

610
# Special permissions required for OIDC authentication
711
permissions:
@@ -13,7 +17,7 @@ jobs:
1317
gh-release-publish:
1418
name: 'GitHub: Publish Release'
1519
runs-on: ubuntu-latest
16-
if: github.event_name == 'release' && success()
20+
if: inputs.deployment_status == 'success'
1721
env:
1822
GH_TOKEN: ${{ secrets.GH_TOKEN }}
1923
steps:
@@ -30,7 +34,7 @@ jobs:
3034
gh-release-delete:
3135
name: 'GitHub: Delete Prerelease'
3236
runs-on: ubuntu-latest
33-
if: github.event_name == 'release' && failure() || cancelled()
37+
if: inputs.deployment_status != 'success'
3438
env:
3539
GH_TOKEN: ${{ secrets.GH_TOKEN }}
3640
steps:

.github/workflows/k8s_deploy.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
environment:
77
required: true
88
type: string
9+
outputs:
10+
deployment_status:
11+
description: "The status of the deployment"
12+
value: ${{ jobs.k8-deploy.outputs.deployment_status }}
913

1014

1115
# Special permissions required for OIDC authentication
@@ -30,6 +34,8 @@ jobs:
3034
AZURE_RESOURCE_GROUP: "${{ vars.AZURE_RESOURCE_GROUP }}"
3135
AZURE_CONTAINER_REGISTRY: "${{ vars.AZURE_CONTAINER_REGISTRY }}"
3236
IMAGE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || 'latest' }}
37+
outputs:
38+
deployment_status: ${{ steps.assert_deployment_success.outcome }}
3339
steps:
3440
# Checkout the repository to the GitHub Actions runner
3541
- name: Checkout
@@ -89,6 +95,7 @@ jobs:
8995
percentage: 20
9096

9197
- name: Assert Deployment Success
98+
id: assert_deployment_success
9299
timeout-minutes: 5
93100
shell: bash
94101
run: |

.github/workflows/k8s_release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434
needs: [call-k8-deploy]
3535
if: always() && github.event_name == 'release'
3636
secrets: inherit
37+
with:
38+
deployment_status: ${{ needs.call-k8-deploy.outputs.deployment_status }}
3739

3840
call-gh-delete-branch:
3941
needs: [call-k8-deploy]

0 commit comments

Comments
 (0)