Skip to content

Commit b7b91d2

Browse files
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
2 parents 9158018 + 313bff3 commit b7b91d2

File tree

6 files changed

+72
-159
lines changed

6 files changed

+72
-159
lines changed

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

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/actions/build-proxies/action.yml

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,39 @@ inputs:
2525
description: "Name of the Component to deploy"
2626
required: true
2727
default: 'api'
28+
nodejs_version:
29+
description: "Node.js version, set by the CI/CD pipeline workflow"
30+
required: true
31+
NODE_AUTH_TOKEN:
32+
description: "Token for access to github package registry"
33+
required: true
2834

2935
runs:
3036
using: composite
3137

3238
steps:
33-
- name: Download OAS Spec artifact
34-
uses: actions/download-artifact@v4
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
- uses: actions/setup-node@v4
3542
with:
36-
name: api-oas-specification-${{ inputs.apimEnv }}${{ inputs.version != '' && format('-{0}', inputs.version) || '' }}
37-
path: ./build
43+
node-version: ${{ inputs.nodejs_version }}
44+
registry-url: 'https://npm.pkg.github.com'
45+
46+
- name: "Cache node_modules"
47+
uses: actions/cache@v4
48+
with:
49+
path: |
50+
**/node_modules
51+
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
52+
restore-keys: |
53+
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
54+
55+
- name: Npm install
56+
working-directory: .
57+
env:
58+
NODE_AUTH_TOKEN: ${{ inputs.NODE_AUTH_TOKEN }}
59+
run: npm ci
60+
shell: bash
3861

3962
- name: Setup Proxy Name and target
4063
shell: bash
@@ -64,10 +87,21 @@ runs:
6487
echo "MTLS_NAME=notify-supplier-mtls-pr$PR_NUMBER" >> $GITHUB_ENV
6588
fi
6689
67-
- name: Set APIM_ENV
90+
- name: Build ${{ inputs.apimEnv }} oas
91+
working-directory: .
92+
env:
93+
APIM_ENV: ${{ inputs.apimEnv }}
6894
shell: bash
6995
run: |
70-
APIM_ENV="${{ inputs.apimEnv }}"
96+
if [ ${{ env.APIM_ENV }} == "internal-dev-sandbox" ] && [ ${{ inputs.buildSandbox }} == true ]
97+
then
98+
echo "Building sandbox OAS spec"
99+
make build-json-oas-spec APIM_ENV=sandbox
100+
else
101+
echo "Building env specific OAS spec"
102+
make build-json-oas-spec APIM_ENV=${{ env.APIM_ENV }}
103+
fi
104+
71105
if [[ $APIM_ENV == *-pr ]]; then
72106
echo "Removing pr suffix from APIM_ENV after building OAS and calling proxygen"
73107
APIM_ENV=$(echo "$APIM_ENV" | sed 's/-pr$//')

.github/actions/build-sdk/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ runs:
5555
run: |
5656
make build VERSION="${{ inputs.version }}"
5757
58+
- name: Upload API OAS specification artifact
59+
uses: actions/upload-artifact@v4
60+
with:
61+
path: "build"
62+
name: api-oas-specification-${{ inputs.version }}
63+
5864
- name: Upload html artifact
5965
uses: actions/upload-artifact@v4
6066
with:

.github/workflows/manual-proxy-environment-deploy.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ jobs:
7777
echo "ENVIRONMENT=$ENVIRONMENT" >> $GITHUB_ENV
7878
echo "APIM_ENV=$APIM_ENV" >> $GITHUB_ENV
7979
80-
- name: "Build OAS spec"
81-
uses: ./.github/actions/build-oas-spec
82-
with:
83-
apimEnv: "${{ env.APIM_ENV }}"
84-
buildSandbox: ${{ inputs.build_sandbox }}
85-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86-
8780
- name: "Build proxies"
8881
env:
8982
PROXYGEN_API_NAME: nhs-notify-supplier
@@ -97,3 +90,4 @@ jobs:
9790
runId: "${{ github.run_id }}"
9891
buildSandbox: ${{ inputs.build_sandbox }}
9992
releaseVersion: ${{ github.ref_name }}
93+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -55,48 +55,9 @@ jobs:
5555
version: "${{ inputs.version }}"
5656
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5757

58-
artefact-oas-spec:
59-
name: "Build OAS spec (${{ matrix.apimEnv }})"
60-
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
61-
runs-on: ubuntu-latest
62-
needs: [artefact-jekyll-docs]
63-
timeout-minutes: 10
64-
strategy:
65-
matrix:
66-
apimEnv: [internal-dev-pr, internal-dev, int, ref, prod]
67-
steps:
68-
- name: "Checkout code"
69-
uses: actions/checkout@v5
70-
- name: "Build OAS spec"
71-
uses: ./.github/actions/build-oas-spec
72-
with:
73-
version: "${{ inputs.version }}"
74-
apimEnv: "${{ matrix.apimEnv }}"
75-
buildSandbox: false
76-
nodejs_version: ${{ inputs.nodejs_version }}
77-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78-
79-
artefact-oas-spec-sandbox:
80-
name: "Build OAS spec for sandbox"
81-
runs-on: ubuntu-latest
82-
needs: [artefact-jekyll-docs]
83-
timeout-minutes: 10
84-
steps:
85-
- name: "Checkout code"
86-
uses: actions/checkout@v5
87-
- name: "Build proxies"
88-
uses: ./.github/actions/build-oas-spec
89-
with:
90-
version: "${{ inputs.version }}"
91-
apimEnv: "internal-dev-sandbox"
92-
buildSandbox: true
93-
nodejs_version: ${{ inputs.nodejs_version }}
94-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95-
9658
artefact-sdks:
9759
name: "Build SDKs"
9860
runs-on: ubuntu-latest
99-
needs: [artefact-oas-spec]
10061
timeout-minutes: 10
10162
steps:
10263
- name: "Checkout code"
@@ -133,7 +94,6 @@ jobs:
13394
pr-create-dynamic-environment:
13495
name: Create Dynamic Environment
13596
runs-on: ubuntu-latest
136-
if: inputs.pr_number != ''
13797
steps:
13898
- uses: actions/checkout@v5
13999
- name: Trigger dynamic environment creation
@@ -157,8 +117,7 @@ jobs:
157117
artefact-proxies:
158118
name: "Build proxies"
159119
runs-on: ubuntu-latest
160-
if: inputs.pr_number != ''
161-
needs: [artefact-oas-spec-sandbox, pr-create-dynamic-environment]
120+
needs: [pr-create-dynamic-environment]
162121
timeout-minutes: 10
163122
env:
164123
PROXYGEN_API_NAME: nhs-notify-supplier
@@ -177,3 +136,5 @@ jobs:
177136
runId: "${{ github.run_id }}"
178137
buildSandbox: true
179138
releaseVersion: ${{ github.head_ref || github.ref_name }}
139+
nodejs_version: ${{ inputs.nodejs_version }}
140+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ 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 }}
4643

4744
steps:
4845
- name: "Checkout code"
@@ -90,6 +87,12 @@ jobs:
9087
path: ./artifacts/sdk-csharp-${{ inputs.version }}
9188
name: sdk-csharp-${{ inputs.version }}
9289

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+
9396
# Take out for now - might add again in the future
9497
# - name: "Get the artefacts 9"
9598
# uses: actions/download-artifact@v6
@@ -204,6 +207,22 @@ jobs:
204207
asset_name: sdk-csharp-${{ inputs.version }}.zip
205208
asset_content_type: "application/gzip"
206209

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+
207226
# Take out for now - might add again in the future
208227
# - name: "zip csharp server release asset"
209228
# # GitHub pages needs a single tar called artifact inside the zip.
@@ -222,39 +241,6 @@ jobs:
222241
# asset_name: server-csharp-${{ inputs.version }}.zip
223242
# asset_content_type: "application/gzip"
224243

225-
publish-oas-specs:
226-
name: "Publish OAS spec (${{ matrix.apimEnv }})"
227-
runs-on: ubuntu-latest
228-
needs: [publish]
229-
permissions:
230-
id-token: write # This is required for requesting the JWT
231-
contents: read # This is required for actions/checkout
232-
timeout-minutes: 10
233-
strategy:
234-
matrix:
235-
apimEnv: [internal-dev, int, ref, prod]
236-
steps:
237-
- name: "Download OAS spec artifact"
238-
uses: actions/download-artifact@v6
239-
with:
240-
path: ./artifacts/api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}
241-
name: api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}
242-
243-
- name: "Zip OAS specification"
244-
working-directory: ./artifacts/api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}
245-
run: zip -r ../api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}.zip .
246-
shell: bash
247-
248-
- name: "Upload OAS specification release asset"
249-
uses: actions/upload-release-asset@v1
250-
env:
251-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
252-
with:
253-
upload_url: ${{ needs.publish.outputs.upload_url }}
254-
asset_path: ./artifacts/api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}.zip
255-
asset_name: api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}.zip
256-
asset_content_type: "application/zip"
257-
258244
# Take out for now - might add again in the future
259245
# ### 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.
260246
# publishdocker:

0 commit comments

Comments
 (0)