Skip to content

Commit eb0b83a

Browse files
committed
Revert "Feature/ccm 13428 trigger proxy deploy (#310)"
This reverts commit 64ece87.
1 parent 64ece87 commit eb0b83a

File tree

7 files changed

+76
-202
lines changed

7 files changed

+76
-202
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: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ inputs:
88
releaseVersion:
99
description: "Release, tag, branch, or commit ID to be used for deployment"
1010
required: true
11-
isRelease:
12-
description: "True if releaseVersion is a release tag (if set, downloads from release assets instead of workflow artifacts)"
13-
required: false
14-
default: false
1511
environment:
1612
description: "Deployment environment"
1713
required: true
@@ -29,33 +25,39 @@ inputs:
2925
description: "Name of the Component to deploy"
3026
required: true
3127
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
3234

3335
runs:
3436
using: composite
3537

3638
steps:
37-
- name: Download OAS Spec artifact from workflow
38-
if: ${{ inputs.isRelease == 'false' }}
39-
uses: actions/download-artifact@v4
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
- uses: actions/setup-node@v4
4042
with:
41-
name: api-oas-specification-${{ inputs.apimEnv }}${{ inputs.version != '' && format('-{0}', inputs.version) || '' }}
42-
path: ./build
43+
node-version: ${{ inputs.nodejs_version }}
44+
registry-url: 'https://npm.pkg.github.com'
4345

44-
- name: Download OAS Spec artifact from release
45-
if: ${{ inputs.isRelease == 'true' }}
46-
shell: bash
47-
run: |
48-
mkdir ./build
49-
ASSET_PATTERN="api-oas-specification-${{ inputs.apimEnv }}-*.zip"
50-
gh release download "${{ inputs.releaseVersion }}" \
51-
--pattern "$ASSET_PATTERN" \
52-
--dir ./build
53-
# Unzip the downloaded file (there should be exactly one match)
54-
ASSET_FILE=$(ls ./build/api-oas-specification-${{ inputs.apimEnv }}-*.zip)
55-
unzip "$ASSET_FILE" -d ./build
56-
rm "$ASSET_FILE"
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: .
5757
env:
58-
GH_TOKEN: ${{ github.token }}
58+
NODE_AUTH_TOKEN: ${{ inputs.NODE_AUTH_TOKEN }}
59+
run: npm ci
60+
shell: bash
5961

6062
- name: Setup Proxy Name and target
6163
shell: bash
@@ -85,10 +87,21 @@ runs:
8587
echo "MTLS_NAME=notify-supplier-mtls-pr$PR_NUMBER" >> $GITHUB_ENV
8688
fi
8789
88-
- name: Set APIM_ENV
90+
- name: Build ${{ inputs.apimEnv }} oas
91+
working-directory: .
92+
env:
93+
APIM_ENV: ${{ inputs.apimEnv }}
8994
shell: bash
9095
run: |
91-
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+
92105
if [[ $APIM_ENV == *-pr ]]; then
93106
echo "Removing pr suffix from APIM_ENV after building OAS and calling proxygen"
94107
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/release_created.yaml

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ jobs:
1717
id-token: write
1818
contents: read
1919

20+
strategy:
21+
max-parallel: 1
22+
matrix:
23+
component: [api]
24+
2025
steps:
2126
- name: Checkout repository
2227
uses: actions/checkout@v5
@@ -31,32 +36,5 @@ jobs:
3136
--targetWorkflow "dispatch-deploy-static-notify-supplier-api-env.yaml" \
3237
--targetEnvironment "main" \
3338
--targetAccountGroup "nhs-notify-supplier-api-nonprod" \
34-
--targetComponent "api" \
39+
--targetComponent "${{ matrix.component }}" \
3540
--terraformAction "apply"
36-
deploy-proxy:
37-
name: "Deploy proxy"
38-
runs-on: ubuntu-latest
39-
timeout-minutes: 10
40-
41-
permissions:
42-
id-token: write
43-
contents: read
44-
actions: read
45-
46-
env:
47-
PROXYGEN_API_NAME: nhs-notify-supplier
48-
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
49-
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
50-
51-
steps:
52-
- name: "Checkout code"
53-
uses: actions/checkout@v5
54-
55-
- name: "Build proxies"
56-
uses: ./.github/actions/build-proxies
57-
with:
58-
environment: "main"
59-
apimEnv: "int"
60-
runId: "${{ github.run_id }}"
61-
releaseVersion: "${{ github.event.release.tag_name }}"
62-
isRelease: true

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

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -55,47 +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-
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"
80-
runs-on: ubuntu-latest
81-
needs: [artefact-jekyll-docs]
82-
timeout-minutes: 10
83-
steps:
84-
- name: "Checkout code"
85-
uses: actions/checkout@v5
86-
- name: "Build proxies"
87-
uses: ./.github/actions/build-oas-spec
88-
with:
89-
version: "${{ inputs.version }}"
90-
apimEnv: "internal-dev-sandbox"
91-
buildSandbox: true
92-
nodejs_version: ${{ inputs.nodejs_version }}
93-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94-
9558
artefact-sdks:
9659
name: "Build SDKs"
9760
runs-on: ubuntu-latest
98-
needs: [artefact-oas-spec]
9961
timeout-minutes: 10
10062
steps:
10163
- name: "Checkout code"
@@ -132,7 +94,6 @@ jobs:
13294
pr-create-dynamic-environment:
13395
name: Create Dynamic Environment
13496
runs-on: ubuntu-latest
135-
if: inputs.pr_number != ''
13697
steps:
13798
- uses: actions/checkout@v5
13899
- name: Trigger dynamic environment creation
@@ -156,8 +117,7 @@ jobs:
156117
artefact-proxies:
157118
name: "Build proxies"
158119
runs-on: ubuntu-latest
159-
if: inputs.pr_number != ''
160-
needs: [artefact-oas-spec-sandbox, pr-create-dynamic-environment]
120+
needs: [pr-create-dynamic-environment]
161121
timeout-minutes: 10
162122
env:
163123
PROXYGEN_API_NAME: nhs-notify-supplier
@@ -176,3 +136,5 @@ jobs:
176136
runId: "${{ github.run_id }}"
177137
buildSandbox: true
178138
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 & 33 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,36 +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-
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-
255244
# Take out for now - might add again in the future
256245
# ### 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.
257246
# publishdocker:

0 commit comments

Comments
 (0)