Skip to content

Commit f135b23

Browse files
initial attempt at git workflow
1 parent 24716e2 commit f135b23

File tree

10 files changed

+102
-22
lines changed

10 files changed

+102
-22
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 proxygen-cli
48+
49+
# Setup proxygen auth and settings
50+
mkdir -p ${HOME}/.proxygen
51+
echo -n $PROXYGEN_PRIVATE_KEY > ${HOME}/.proxygen/key
52+
envsubst < ./.github/proxygen-credentials-template.yaml > ${HOME}/.proxygen/credentials.yaml
53+
envsubst < ./.github/proxygen-credentials-template.yaml | cat
54+
envsubst < ./.github/proxygen-settings.yaml > ${HOME}/.proxygen/settings.yaml
55+
envsubst < ./.github/proxygen-settings.yaml | cat
56+
57+
58+
- name: Deploy to Internal Dev
59+
shell: bash
60+
run: |
61+
echo $INSTANCE
62+
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/stage-3-build.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,32 @@ jobs:
8181
with:
8282
version: "${{ inputs.version }}"
8383

84+
artefact-proxies:
85+
name: "Build proxies"
86+
runs-on: ubuntu-latest
87+
timeout-minutes: 10
88+
env:
89+
PROXYGEN_PRIVATE_KEY: ${{ secrets.PROXYGEN_NOTIFY_SUPPLIER_PRIVATE_KEY }}
90+
PROXYGEN_KID: notify-supplier-key-1
91+
PROXYGEN_CLIENT_ID: nhs-notify-supplier-client
92+
PROXYGEN_API_NAME: nhs-notify-supplier
93+
PR_NUMBER: ${{ github.event.number }}
94+
steps:
95+
- name: Verify environment variables
96+
shell: bash
97+
run: |
98+
echo "PROXYGEN_PRIVATE_KEY is set: [${{ secrets.PROXYGEN_NOTIFY_SUPPLIER_PRIVATE_KEY != '' }}]"
99+
echo "PROXYGEN_KID: $PROXYGEN_KID"
100+
echo "PROXYGEN_CLIENT_ID: $PROXYGEN_CLIENT_ID"
101+
echo "PROXYGEN_API_NAME: $PROXYGEN_API_NAME"
102+
echo "PR_NUMBER: $PR_NUMBER"
103+
- name: "Checkout code"
104+
uses: actions/checkout@v4
105+
- name: "Build proxies"
106+
uses: ./.github/actions/build-proxies
107+
with:
108+
version: "${{ inputs.version }}"
109+
84110
# artefact-1:
85111
# name: "Artefact 1"
86112
# 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

specification/api/notify-supplier-phase1.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
openapi: 3.1.1
1+
openapi: 3.0.3
22
info:
33
version: next
44
title: NHS Notify Supplier API
@@ -8,7 +8,7 @@ info:
88
This specification represents the in-development 'next' version of the API schema
99
and should be treated as unstable.
1010
security:
11-
- authorization: [ ]
11+
- app-level0: [ ]
1212
paths:
1313
/letter:
1414
parameters:
@@ -77,16 +77,10 @@ paths:
7777
$ref: 'components/endpoints/headDataId.yml'
7878
components:
7979
securitySchemes:
80-
authorization:
81-
type: oauth2
82-
description: |-
83-
An [OAuth 2.0 bearer token](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation/application-restricted-restful-apis-signed-jwt-authentication).
84-
Required in all environments except local and sandbox.
85-
flows:
86-
authorizationCode:
87-
authorizationUrl: ''
88-
tokenUrl: ''
89-
scopes: []
80+
nhs-login-p0:
81+
$ref: https://proxygen.ptl.api.platform.nhs.uk/components/securitySchemes/nhs-login-p0
82+
app-level0:
83+
$ref: https://proxygen.ptl.api.platform.nhs.uk/components/securitySchemes/app-level0
9084
tags:
9185
- name: letter
9286
description: ''

0 commit comments

Comments
 (0)