Skip to content

Commit cebfa79

Browse files
committed
CCM-13419 Generate specification variants on build
1 parent e372209 commit cebfa79

File tree

3 files changed

+57
-30
lines changed

3 files changed

+57
-30
lines changed

.github/actions/build-oas-spec/action.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ runs:
6161
make build-json-oas-spec APIM_ENV=${{ env.APIM_ENV }}
6262
fi
6363
64-
if [[ $APIM_ENV == *-pr ]]; then
65-
echo "Removing pr suffix from APIM_ENV after building OAS and calling proxygen"
66-
APIM_ENV=$(echo "$APIM_ENV" | sed 's/-pr$//')
67-
fi
68-
echo "APIM_ENV=$APIM_ENV" >> $GITHUB_ENV
69-
7064
- name: Upload API OAS specification artifact
7165
uses: actions/upload-artifact@v4
7266
with:

.github/workflows/stage-3-build.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,27 @@ jobs:
5656
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5757

5858
artefact-oas-spec:
59-
name: "Build OAS spec"
59+
name: "Build OAS spec (${{ matrix.apimEnv }})"
60+
runs-on: ubuntu-latest
61+
needs: [artefact-jekyll-docs]
62+
timeout-minutes: 10
63+
strategy:
64+
matrix:
65+
apimEnv: [internal-dev-pr, internal-dev, int, ref, prod]
66+
steps:
67+
- name: "Checkout code"
68+
uses: actions/checkout@v5
69+
- name: "Build OAS spec"
70+
uses: ./.github/actions/build-oas-spec
71+
with:
72+
version: "${{ inputs.version }}"
73+
apimEnv: "${{ matrix.apimEnv }}"
74+
buildSandbox: false
75+
nodejs_version: ${{ inputs.nodejs_version }}
76+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
78+
artefact-oas-spec-sandbox:
79+
name: "Build OAS spec for sandbox"
6080
runs-on: ubuntu-latest
6181
needs: [artefact-jekyll-docs]
6282
timeout-minutes: 10
@@ -112,6 +132,7 @@ jobs:
112132
pr-create-dynamic-environment:
113133
name: Create Dynamic Environment
114134
runs-on: ubuntu-latest
135+
if: inputs.pr_number != ''
115136
steps:
116137
- uses: actions/checkout@v5
117138
- name: Trigger dynamic environment creation
@@ -135,7 +156,8 @@ jobs:
135156
artefact-proxies:
136157
name: "Build proxies"
137158
runs-on: ubuntu-latest
138-
needs: [artefact-oas-spec, pr-create-dynamic-environment]
159+
if: inputs.pr_number != ''
160+
needs: [artefact-oas-spec-sandbox, pr-create-dynamic-environment]
139161
timeout-minutes: 10
140162
env:
141163
PROXYGEN_API_NAME: nhs-notify-supplier

.github/workflows/stage-5-publish.yaml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
name: "Publish packages"
4141
runs-on: ubuntu-latest
4242
timeout-minutes: 10
43+
outputs:
44+
release_id: ${{ steps.create_release.outputs.id }}
45+
upload_url: ${{ steps.create_release.outputs.upload_url }}
4346

4447
steps:
4548
- name: "Checkout code"
@@ -87,12 +90,6 @@ jobs:
8790
path: ./artifacts/sdk-csharp-${{ inputs.version }}
8891
name: sdk-csharp-${{ inputs.version }}
8992

90-
- name: "Get the artefacts 8"
91-
uses: actions/download-artifact@v6
92-
with:
93-
path: ./artifacts/api-oas-specification-${{ inputs.version }}
94-
name: api-oas-specification-${{ inputs.version }}
95-
9693
# Take out for now - might add again in the future
9794
# - name: "Get the artefacts 9"
9895
# uses: actions/download-artifact@v6
@@ -207,22 +204,6 @@ jobs:
207204
asset_name: sdk-csharp-${{ inputs.version }}.zip
208205
asset_content_type: "application/gzip"
209206

210-
- name: "zip api OAS specification release asset"
211-
# GitHub pages needs a single tar called artifact inside the zip.
212-
working-directory: ./artifacts/api-oas-specification-${{ inputs.version }}
213-
run: zip -r ../api-oas-specification-${{ inputs.version }}.zip .
214-
shell: bash
215-
216-
- name: "Upload api OAS specification release asset"
217-
uses: actions/upload-release-asset@v1
218-
env:
219-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220-
with:
221-
upload_url: "${{ steps.create_release.outputs.upload_url }}"
222-
asset_path: ./artifacts/api-oas-specification-${{ inputs.version }}.zip
223-
asset_name: api-oas-specification-${{ inputs.version }}.zip
224-
asset_content_type: "application/gzip"
225-
226207
# Take out for now - might add again in the future
227208
# - name: "zip csharp server release asset"
228209
# # GitHub pages needs a single tar called artifact inside the zip.
@@ -241,6 +222,36 @@ jobs:
241222
# asset_name: server-csharp-${{ inputs.version }}.zip
242223
# asset_content_type: "application/gzip"
243224

225+
publish-oas-specs:
226+
name: "Publish OAS spec (${{ matrix.apimEnv }})"
227+
runs-on: ubuntu-latest
228+
needs: [publish]
229+
timeout-minutes: 10
230+
strategy:
231+
matrix:
232+
apimEnv: [internal-dev, int, ref, prod]
233+
steps:
234+
- name: "Download OAS spec artifact"
235+
uses: actions/download-artifact@v6
236+
with:
237+
path: ./artifacts/api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}
238+
name: api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}
239+
240+
- name: "Zip OAS specification"
241+
working-directory: ./artifacts/api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}
242+
run: zip -r ../api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}.zip .
243+
shell: bash
244+
245+
- name: "Upload OAS specification release asset"
246+
uses: actions/upload-release-asset@v1
247+
env:
248+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
249+
with:
250+
upload_url: ${{ needs.publish.outputs.upload_url }}
251+
asset_path: ./artifacts/api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}.zip
252+
asset_name: api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}.zip
253+
asset_content_type: "application/zip"
254+
244255
# Take out for now - might add again in the future
245256
# ### PUBLISH DOCKER - THIS NEEDS CHANGING TO DO THE DOCKER BUILD IN THE BUILD STAGE AND ARTIFACT IT. SEE publishlibhostdocker below how how and the buildlibs action.
246257
# publishdocker:

0 commit comments

Comments
 (0)