Skip to content

Commit 56dd50d

Browse files
committed
Revert "Refactor build steps"
This reverts commit a2701673e205c185a711bfa1744ee328b2df770f.
1 parent 341eed3 commit 56dd50d

File tree

4 files changed

+59
-90
lines changed

4 files changed

+59
-90
lines changed

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

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

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

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,40 @@ 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:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
- uses: actions/setup-node@v4
42+
with:
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
61+
3362
- name: Setup Proxy Name and target
3463
shell: bash
3564
run: |
@@ -58,6 +87,27 @@ runs:
5887
echo "MTLS_NAME=notify-supplier-mtls-pr$PR_NUMBER" >> $GITHUB_ENV
5988
fi
6089
90+
- name: Build ${{ inputs.apimEnv }} oas
91+
working-directory: .
92+
env:
93+
APIM_ENV: ${{ inputs.apimEnv }}
94+
shell: bash
95+
run: |
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+
105+
if [[ $APIM_ENV == *-pr ]]; then
106+
echo "Removing pr suffix from APIM_ENV after building OAS and calling proxygen"
107+
APIM_ENV=$(echo "$APIM_ENV" | sed 's/-pr$//')
108+
fi
109+
echo "APIM_ENV=$APIM_ENV" >> $GITHUB_ENV
110+
61111
- name: Upload OAS Spec
62112
uses: actions/upload-artifact@v4
63113
with:
@@ -66,7 +116,6 @@ runs:
66116

67117
- name: Trigger deploy proxy
68118
env:
69-
APIM_ENV: ${{ inputs.apimEnv }}
70119
APP_CLIENT_ID: ${{ env.APP_CLIENT_ID }}
71120
APP_PEM_FILE: ${{ env.APP_PEM_FILE }}
72121
shell: bash

.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/stage-3-build.yaml

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

58-
artefact-oas-spec:
59-
name: "Build OAS spec"
60-
runs-on: ubuntu-latest
61-
needs: [artefact-jekyll-docs]
62-
timeout-minutes: 10
63-
steps:
64-
- name: "Checkout code"
65-
uses: actions/checkout@v5
66-
- name: "Build proxies"
67-
uses: ./.github/actions/build-oas-spec
68-
with:
69-
apimEnv: "internal-dev-sandbox"
70-
buildSandbox: true
71-
nodejs_version: ${{ inputs.nodejs_version }}
72-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73-
7458
artefact-sdks:
7559
name: "Build SDKs"
7660
runs-on: ubuntu-latest
77-
needs: [artefact-oas-spec]
7861
timeout-minutes: 10
7962
steps:
8063
- name: "Checkout code"
@@ -134,7 +117,7 @@ jobs:
134117
artefact-proxies:
135118
name: "Build proxies"
136119
runs-on: ubuntu-latest
137-
needs: [artefact-oas-spec, pr-create-dynamic-environment]
120+
needs: [pr-create-dynamic-environment]
138121
timeout-minutes: 10
139122
env:
140123
PROXYGEN_API_NAME: nhs-notify-supplier
@@ -153,3 +136,5 @@ jobs:
153136
runId: "${{ github.run_id }}"
154137
buildSandbox: true
155138
releaseVersion: ${{ github.head_ref || github.ref_name }}
139+
nodejs_version: ${{ inputs.nodejs_version }}
140+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)