Skip to content

Commit 4764c65

Browse files
workflow improvements
1 parent 4d7a354 commit 4764c65

2 files changed

Lines changed: 76 additions & 130 deletions

File tree

Lines changed: 15 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: "CI/CD: Release"
22

3-
# Triggered by pushing a v* tag (e.g. git tag v1.2.3 && git push origin v1.2.3).
4-
# Builds the release artifact then deploys infra + software through each
5-
# environment in sequence, running a smoke test before promoting to the next.
6-
#
73
# Prod requires a manual approval — configure required reviewers in GitHub
84
# Settings → Environments → prod before provisioning the prod environment.
95

@@ -38,152 +34,41 @@ jobs:
3834
new_release_published: true
3935
secrets: inherit
4036

41-
# ---- dev ------------------------------------------------------------------
42-
43-
deploy-infra-dev:
44-
name: Deploy infra (dev)
37+
deploy-dev:
38+
name: Deploy (dev)
4539
needs: build-stage
46-
permissions:
47-
id-token: write
48-
uses: ./.github/workflows/stage-4-deploy.yaml
49-
with:
50-
environments: '["dev"]'
51-
commit_sha: ${{ github.sha }}
52-
secrets: inherit
53-
54-
deploy-app-dev:
55-
name: Deploy app (dev)
56-
needs: deploy-infra-dev
57-
permissions:
58-
id-token: write
59-
uses: ./.github/workflows/stage-4-deploy-app.yaml
40+
uses: ./.github/workflows/stage-4-deploy-env.yaml
6041
with:
61-
environments: '["dev"]'
42+
environment: dev
6243
release_tag: ${{ github.ref_name }}
6344
commit_sha: ${{ github.sha }}
6445
secrets: inherit
6546

66-
smoke-test-dev:
67-
name: Smoke test (dev)
68-
needs: deploy-app-dev
69-
runs-on: ubuntu-latest
70-
environment: dev
71-
permissions:
72-
id-token: write
73-
steps:
74-
- name: Checkout code
75-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
76-
77-
- name: Azure login
78-
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0
79-
with:
80-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
81-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
82-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
83-
84-
- name: Run smoke test
85-
run: bash scripts/bash/smoke_test.sh dev
86-
87-
# ---- preprod --------------------------------------------------------------
88-
89-
deploy-infra-preprod:
90-
name: Deploy infra (preprod)
91-
needs: smoke-test-dev
92-
permissions:
93-
id-token: write
94-
uses: ./.github/workflows/stage-4-deploy.yaml
95-
with:
96-
environments: '["preprod"]'
97-
commit_sha: ${{ github.sha }}
98-
secrets: inherit
99-
100-
deploy-app-preprod:
101-
name: Deploy app (preprod)
102-
needs: deploy-infra-preprod
103-
permissions:
104-
id-token: write
105-
uses: ./.github/workflows/stage-4-deploy-app.yaml
47+
deploy-preprod:
48+
name: Deploy (preprod)
49+
needs: deploy-dev
50+
uses: ./.github/workflows/stage-4-deploy-env.yaml
10651
with:
107-
environments: '["preprod"]'
52+
environment: preprod
10853
release_tag: ${{ github.ref_name }}
10954
commit_sha: ${{ github.sha }}
11055
secrets: inherit
11156

112-
smoke-test-preprod:
113-
name: Smoke test (preprod)
114-
needs: deploy-app-preprod
115-
runs-on: ubuntu-latest
116-
environment: preprod
117-
permissions:
118-
id-token: write
119-
steps:
120-
- name: Checkout code
121-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
122-
123-
- name: Azure login
124-
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0
125-
with:
126-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
127-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
128-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
129-
130-
- name: Run smoke test
131-
run: bash scripts/bash/smoke_test.sh preprod
132-
133-
# ---- prod -----------------------------------------------------------------
134-
# Requires the 'prod' GitHub Environment to be configured with required
135-
# reviewers (Settings → Environments → prod → Required reviewers).
136-
# Jobs will be added once the prod Azure environment is provisioned.
137-
13857
prod-approval:
13958
name: Awaiting prod approval
140-
needs: smoke-test-preprod
59+
needs: deploy-preprod
14160
runs-on: ubuntu-latest
14261
environment: prod
14362
steps:
14463
- name: Approved
145-
run: echo "Prod deployment approved proceeding"
64+
run: echo "Prod deployment approved - proceeding"
14665

147-
deploy-infra-prod:
148-
name: Deploy infra (prod)
66+
deploy-prod:
67+
name: Deploy (prod)
14968
needs: prod-approval
150-
permissions:
151-
id-token: write
152-
uses: ./.github/workflows/stage-4-deploy.yaml
69+
uses: ./.github/workflows/stage-4-deploy-env.yaml
15370
with:
154-
environments: '["prod"]'
155-
commit_sha: ${{ github.sha }}
156-
secrets: inherit
157-
158-
deploy-app-prod:
159-
name: Deploy app (prod)
160-
needs: deploy-infra-prod
161-
permissions:
162-
id-token: write
163-
uses: ./.github/workflows/stage-4-deploy-app.yaml
164-
with:
165-
environments: '["prod"]'
71+
environment: prod
16672
release_tag: ${{ github.ref_name }}
16773
commit_sha: ${{ github.sha }}
16874
secrets: inherit
169-
170-
smoke-test-prod:
171-
name: Smoke test (prod)
172-
needs: deploy-app-prod
173-
runs-on: ubuntu-latest
174-
environment: prod
175-
permissions:
176-
id-token: write
177-
steps:
178-
- name: Checkout code
179-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
180-
181-
- name: Azure login
182-
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0
183-
with:
184-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
185-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
186-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
187-
188-
- name: Run smoke test
189-
run: bash scripts/bash/smoke_test.sh prod
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Stage 4: Deploy to environment"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
description: Target environment (dev / preprod / prod)
8+
required: true
9+
type: string
10+
release_tag:
11+
description: GitHub release tag to deploy (e.g. v1.2.3)
12+
required: true
13+
type: string
14+
commit_sha:
15+
description: Commit SHA used to trigger the ADO pipeline
16+
required: true
17+
type: string
18+
19+
jobs:
20+
deploy-infra:
21+
name: Deploy infra
22+
permissions:
23+
id-token: write
24+
uses: ./.github/workflows/stage-4-deploy.yaml
25+
with:
26+
environments: '["${{ inputs.environment }}"]'
27+
commit_sha: ${{ inputs.commit_sha }}
28+
secrets: inherit
29+
30+
deploy-app:
31+
name: Deploy app
32+
needs: deploy-infra
33+
permissions:
34+
id-token: write
35+
uses: ./.github/workflows/stage-4-deploy-app.yaml
36+
with:
37+
environments: '["${{ inputs.environment }}"]'
38+
release_tag: ${{ inputs.release_tag }}
39+
commit_sha: ${{ inputs.commit_sha }}
40+
secrets: inherit
41+
42+
smoke-test:
43+
name: Smoke test
44+
needs: deploy-app
45+
runs-on: ubuntu-latest
46+
environment: ${{ inputs.environment }}
47+
permissions:
48+
id-token: write
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
52+
53+
- name: Azure login
54+
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0
55+
with:
56+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
57+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
58+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
59+
60+
- name: Run smoke test
61+
run: bash scripts/bash/smoke_test.sh ${{ inputs.environment }}

0 commit comments

Comments
 (0)