Skip to content

Commit 6199ae5

Browse files
initial attempt at git workflow
1 parent 69ca889 commit 6199ae5

File tree

11 files changed

+111
-22
lines changed

11 files changed

+111
-22
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: "Build Proxies"
2+
description: "Build Proxies"
3+
inputs:
4+
version:
5+
description: "Version number"
6+
required: true
7+
runs:
8+
using: composite
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 24
16+
17+
- name: Npm install
18+
working-directory: .
19+
run: npm ci
20+
shell: bash
21+
22+
- name: Build oas
23+
working-directory: .
24+
shell: bash
25+
run: |
26+
make publish-oas
27+
28+
- name: Setup Proxy Name
29+
shell: bash
30+
run: |
31+
32+
if [ -z $PR_NUMBER ]
33+
then
34+
echo "INSTANCE=$PROXYGEN_API_NAME" >> $GITHUB_ENV
35+
else
36+
echo "INSTANCE=$PROXYGEN_API_NAME-$PR_NUMBER" >> $GITHUB_ENV
37+
fi
38+
39+
echo "Instance name set to: $PROXYGEN_API_NAME${PR_NUMBER:+-$PR_NUMBER}"
40+
41+
42+
43+
- name: Install Proxygen client
44+
shell: bash
45+
run: |
46+
# Install proxygen cli
47+
pip install pipx
48+
pipx install proxygen-cli
49+
50+
# Setup proxygen auth and settings
51+
mkdir -p ${HOME}/.proxygen
52+
echo -n $PROXYGEN_PRIVATE_KEY | base64 --decode > ${HOME}/.proxygen/key
53+
envsubst < ./.github/proxygen-credentials-template.yaml > ${HOME}/.proxygen/credentials.yaml
54+
envsubst < ./.github/proxygen-credentials-template.yaml | cat
55+
envsubst < ./.github/proxygen-settings.yaml > ${HOME}/.proxygen/settings.yaml
56+
envsubst < ./.github/proxygen-settings.yaml | cat
57+
58+
59+
- name: Deploy to Internal Dev
60+
shell: bash
61+
run: |
62+
echo $INSTANCE
63+
proxygen instance deploy internal-dev $INSTANCE build/notify-supplier.json --no-confirm
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
client_id: $PROXYGEN_CLIENT_ID
2+
key_id: $PROXYGEN_KID
3+
private_key_path: key
4+
base_url: https://identity.prod.api.platform.nhs.uk/realms/api-producers

.github/proxygen-settings.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
endpoint_url: https://proxygen.prod.api.platform.nhs.uk
2+
api: nhs-notify-supplier

.github/workflows/cicd-1-pull-request.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ jobs:
5656
if gh pr list --head $branch_name | grep -q .; then
5757
echo "Pull request exists"
5858
echo "does_pull_request_exist=true" >> $GITHUB_OUTPUT
59+
PR_NUMBER=$(gh pr list --head "$branch_name" --state open --json number -q '.[0].number')
60+
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
5961
else
6062
echo "Pull request doesn't exist"
6163
echo "does_pull_request_exist=false" >> $GITHUB_OUTPUT
@@ -72,6 +74,7 @@ jobs:
7274
export VERSION="${{ steps.variables.outputs.version }}"
7375
export DOES_PULL_REQUEST_EXIST="${{ steps.pr_exists.outputs.does_pull_request_exist }}"
7476
export IS_VERSION_PRERELEASE="${{ steps.variables.outputs.is_version_prerelease }}"
77+
export PR_NUMBER="${{ steps.pr_exists.outputs.pr_number }}"
7578
make list-variables
7679
commit-stage: # Recommended maximum execution time is 2 minutes
7780
name: "Commit stage"
@@ -112,6 +115,7 @@ jobs:
112115
python_version: "${{ needs.metadata.outputs.python_version }}"
113116
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
114117
version: "${{ needs.metadata.outputs.version }}"
118+
pr_number: "${{ needs.metadata.outputs.pr_number }}"
115119
secrets: inherit
116120
acceptance-stage: # Recommended maximum execution time is 10 minutes
117121
name: "Acceptance stage"

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ on:
3131
description: "Version of the software, set by the CI/CD pipeline workflow"
3232
required: true
3333
type: string
34+
pr_number:
35+
description: "PR Number if it exists"
36+
required: false
37+
type: string
3438

3539
jobs:
3640
artefact-jekyll-docs:
@@ -81,6 +85,32 @@ jobs:
8185
with:
8286
version: "${{ inputs.version }}"
8387

88+
artefact-proxies:
89+
name: "Build proxies"
90+
runs-on: ubuntu-latest
91+
timeout-minutes: 10
92+
env:
93+
PROXYGEN_PRIVATE_KEY: ${{ secrets.PROXYGEN_ENCODED_NOTIFY_SUPPLIER_PRIVATE_KEY }}
94+
PROXYGEN_KID: notify-supplier-key-1
95+
PROXYGEN_CLIENT_ID: nhs-notify-supplier-client
96+
PROXYGEN_API_NAME: nhs-notify-supplier
97+
PR_NUMBER: ${{ inputs.pr_number }}
98+
steps:
99+
- name: Verify environment variables
100+
shell: bash
101+
run: |
102+
echo "PROXYGEN_PRIVATE_KEY is set: [${{ secrets.PROXYGEN_ENCODED_NOTIFY_SUPPLIER_PRIVATE_KEY != '' }}]"
103+
echo "PROXYGEN_KID: $PROXYGEN_KID"
104+
echo "PROXYGEN_CLIENT_ID: $PROXYGEN_CLIENT_ID"
105+
echo "PROXYGEN_API_NAME: $PROXYGEN_API_NAME"
106+
echo "PR_NUMBER: $PR_NUMBER"
107+
- name: "Checkout code"
108+
uses: actions/checkout@v4
109+
- name: "Build proxies"
110+
uses: ./.github/actions/build-proxies
111+
with:
112+
version: "${{ inputs.version }}"
113+
84114
# artefact-1:
85115
# name: "Artefact 1"
86116
# runs-on: ubuntu-latest

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
},
4747
"scripts": {
4848
"build": "npm run bundle-oas && npm run generate --buildver=$npm_config_buildver",
49-
"bundle-oas": "mkdir -p build && redocly bundle specification/api/notify-supplier-phase1.yml --dereferenced --remove-unused-components --ext yml > build/notify-supplier.yml",
49+
"bundle-oas": "mkdir -p build && redocly bundle specification/api/notify-supplier-phase1.yml --dereferenced -k --remove-unused-components --ext yml > build/notify-supplier.yml",
5050
"generate": "npm run generate:cs --buildver=$npm_config_buildver && npm run generate:html && npm run generate:ts --buildver=$npm_config_buildver && npm run generate:python",
5151
"generate-dependencies": "npm run generate-dependencies --workspaces --if-present",
5252
"generate:cs": "./sdk/generate-cs.sh $npm_config_buildver",
@@ -57,7 +57,7 @@
5757
"lint": "npm run lint --workspaces",
5858
"lint-oas": "redocly lint specification/api/notify-supplier-phase1.yml",
5959
"lint:fix": "npm run lint:fix --workspaces",
60-
"publish-oas": "mkdir -p build && redocly bundle specification/api/notify-supplier-phase1.yml --dereferenced --remove-unused-components --ext json > build/notify-supplier.json",
60+
"publish-oas": "mkdir -p build && redocly bundle specification/api/notify-supplier-phase1.yml --dereferenced -k --remove-unused-components --ext json > build/notify-supplier.json",
6161
"serve": "npm run serve-html-docs",
6262
"serve-html-docs": "npx serve sdk/html -p 3050",
6363
"serve-oas": "redocly preview-docs -p 5000 build/notify-supplier.json",

specification/api/components/endpoints/getDataId.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ summary: Fetch a data file
22
operationId: get-data-id
33
tags:
44
- data
5-
x-stoplight:
6-
id: 98lwlebl1vxeq
75
responses:
86
"303":
97
description: See Other

specification/api/components/schemas/LetterStatusItem.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ properties:
1717
$ref: "./LetterStatus.yml"
1818
requestedProductionStatus:
1919
$ref: "./ProductionStatus.yml"
20-
x-stoplight:
21-
id: kqs13rn7s4wv3
2220
reasonCode:
2321
type: number
2422
description: Reason code for the given status

specification/api/components/schemas/LetterUpdateItem.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ properties:
1414
$ref: "./LetterStatus.yml"
1515
requestedProductionStatus:
1616
$ref: "./ProductionStatus.yml"
17-
x-stoplight:
18-
id: tqw1mlpdzl3v7
1917
description: |-
2018
The requested production status for this letter.
2119
May only be set by NHS Notify.

specification/api/components/schemas/ProductionStatus.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
type: string
2-
x-stoplight:
3-
id: lvub504h38th0
42
enum:
53
- ACTIVE
64
- HOLD

0 commit comments

Comments
 (0)