-
Notifications
You must be signed in to change notification settings - Fork 2
186 lines (178 loc) · 6.53 KB
/
stage-3-build.yaml
File metadata and controls
186 lines (178 loc) · 6.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: "Build stage"
on:
workflow_call:
inputs:
build_datetime:
description: "Build datetime, set by the CI/CD pipeline workflow"
required: true
type: string
build_timestamp:
description: "Build timestamp, set by the CI/CD pipeline workflow"
required: true
type: string
build_epoch:
description: "Build epoch, set by the CI/CD pipeline workflow"
required: true
type: string
nodejs_version:
description: "Node.js version, set by the CI/CD pipeline workflow"
required: true
type: string
python_version:
description: "Python version, set by the CI/CD pipeline workflow"
required: true
type: string
terraform_version:
description: "Terraform version, set by the CI/CD pipeline workflow"
required: true
type: string
version:
description: "Version of the software, set by the CI/CD pipeline workflow"
required: true
type: string
pr_number:
description: "PR Number if it exists"
required: false
type: string
deploy_proxy:
description: "True if the APIM proxy should be deployed"
required: true
type: string
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
packages: read # This is required for downloading from GitHub Package Registry
jobs:
artefact-jekyll-docs:
name: "Build Docs"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: "Build docs"
uses: ./.github/actions/build-docs
with:
version: "${{ inputs.version }}"
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
artefact-oas-spec:
name: "Build OAS spec (${{ matrix.apimEnv }})"
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
needs: [artefact-jekyll-docs]
timeout-minutes: 10
strategy:
matrix:
apimEnv: [internal-dev-pr, internal-dev, int, ref, prod]
steps:
- name: "Checkout code"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: "Build OAS spec"
uses: ./.github/actions/build-oas-spec
with:
version: "${{ inputs.version }}"
apimEnv: "${{ matrix.apimEnv }}"
buildSandbox: false
nodejs_version: ${{ inputs.nodejs_version }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
artefact-oas-spec-sandbox:
name: "Build OAS spec for sandbox"
runs-on: ubuntu-latest
needs: [artefact-jekyll-docs]
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: "Build proxies"
uses: ./.github/actions/build-oas-spec
with:
version: "${{ inputs.version }}"
apimEnv: "internal-dev-sandbox"
buildSandbox: true
nodejs_version: ${{ inputs.nodejs_version }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
artefact-sdks:
name: "Build SDKs"
runs-on: ubuntu-latest
needs: [artefact-oas-spec]
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: "Build sdks"
uses: ./.github/actions/build-sdk
with:
version: "${{ inputs.version }}"
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Take out for now - might add again in the future
# artefact-servers:
# name: "Build servers"
# runs-on: ubuntu-latest
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
# - name: "Build servers"
# uses: ./.github/actions/build-server
# with:
# version: "${{ inputs.version }}"
# artefact-libs:
# name: "Build libs"
# runs-on: ubuntu-latest
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
# - name: "Build servers"
# uses: ./.github/actions/build-libraries
# with:
# version: "${{ inputs.version }}"
pr-create-dynamic-environment:
name: Create Dynamic Environment
runs-on: ubuntu-latest
outputs:
environment_name: ${{ steps.set-environment.outputs.environment_name }}
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Set environment name
id: set-environment
run: echo "environment_name=${{ inputs.pr_number != '' && format('pr{0}', inputs.pr_number) || 'main' }}" >> $GITHUB_OUTPUT
- name: Trigger dynamic environment creation
env:
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
PR_NUMBER: ${{ inputs.pr_number }}
shell: bash
run: |
.github/scripts/dispatch_internal_repo_workflow.sh \
--infraRepoName "$(echo ${{ github.repository }} | cut -d'/' -f2)" \
--releaseVersion ${{ github.head_ref || github.ref_name }} \
--targetWorkflow "dispatch-deploy-dynamic-env.yaml" \
--targetEnvironment "${{ steps.set-environment.outputs.environment_name }}" \
--targetComponent "api" \
--targetAccountGroup "nhs-notify-supplier-api-dev" \
--terraformAction "apply" \
--overrideProjectName "nhs" \
--overrideRoleName "nhs-main-acct-supplier-api-github-deploy"
artefact-proxies:
name: "Build proxies"
runs-on: ubuntu-latest
if: inputs.deploy_proxy == 'true'
needs: [artefact-oas-spec-sandbox, pr-create-dynamic-environment]
timeout-minutes: 10
env:
PROXYGEN_API_NAME: nhs-notify-supplier
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
steps:
- name: "Checkout code"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: "Build proxies"
uses: ./.github/actions/build-proxies
with:
version: "${{ inputs.version }}"
environment: ${{ needs.pr-create-dynamic-environment.outputs.environment_name }}
apimEnv: "internal-dev-sandbox"
runId: "${{ github.run_id }}"
buildSandbox: true
releaseVersion: ${{ github.head_ref || github.ref_name }}