Skip to content

Commit 8d8ec8d

Browse files
committed
Merge branch 'main' into bugfix/eja-fix-targets-and-access
2 parents 96f64f9 + f856ffe commit 8d8ec8d

26 files changed

Lines changed: 2029 additions & 764 deletions

.github/workflows/cicd-2-publish.yaml

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

.github/workflows/cicd-3-deploy.yaml

Lines changed: 0 additions & 74 deletions
This file was deleted.
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Deploy to Dev and Sandbox
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
metadata:
10+
name: "Set CI/CD metadata"
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 1
13+
outputs:
14+
version: ${{ steps.variables.outputs.version }}
15+
steps:
16+
- name: "Set CI/CD variables"
17+
id: variables
18+
run: |
19+
echo "version=spec-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
20+
21+
- name: "List variables"
22+
run: |
23+
echo "Deploying to: DEV & Sandbox"
24+
echo "VERSION=${{ steps.variables.outputs.version }}"
25+
26+
dev:
27+
needs: metadata
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v6
32+
33+
- name: Set up Python 3.11
34+
uses: actions/setup-python@v6
35+
with:
36+
python-version: '3.11'
37+
38+
- name: Set up Node.js
39+
uses: actions/setup-node@v6
40+
with:
41+
node-version: '20'
42+
43+
- name: Install Poetry
44+
run: curl -sSL https://install.python-poetry.org | python3 -
45+
46+
- name: Install Python and Node dependencies
47+
run: |
48+
make install
49+
50+
- name: Install proxygen-cli
51+
run: |
52+
pip install proxygen-cli
53+
54+
- name: Set up Proxygen credentials
55+
env:
56+
PROXYGEN_PRIVATE_KEY: ${{ secrets.PROXYGEN_PRIVATE_KEY }}
57+
run: |
58+
mkdir -p ~/.proxygen
59+
echo "$PROXYGEN_PRIVATE_KEY" > ~/.proxygen/eligibility-signposting-api.pem
60+
make setup-proxygen-credentials
61+
- name: Generate specification
62+
run: |
63+
make construct-spec APIM_ENV=internal-dev
64+
65+
- name: Publish internal-dev spec to Proxygen
66+
run: |
67+
proxygen spec publish build/specification/internal-dev/eligibility-signposting-api.yaml --no-confirm
68+
69+
- name: Deploy internal-dev spec to Proxygen
70+
run: |
71+
proxygen instance deploy internal-dev eligibility-signposting-api build/specification/internal-dev/eligibility-signposting-api.yaml --no-confirm
72+
73+
sandbox:
74+
needs: dev
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Checkout repository
78+
uses: actions/checkout@v6
79+
80+
- name: Set up Python 3.11
81+
uses: actions/setup-python@v6
82+
with:
83+
python-version: '3.11'
84+
85+
- name: Set up Node.js
86+
uses: actions/setup-node@v6
87+
with:
88+
node-version: '20'
89+
90+
- name: Install Poetry
91+
run: curl -sSL https://install.python-poetry.org | python3 -
92+
93+
- name: Install Python and Node dependencies
94+
run: |
95+
make install
96+
97+
- name: Install proxygen-cli
98+
run: |
99+
pip install proxygen-cli
100+
101+
- name: Set up Proxygen credentials
102+
env:
103+
PROXYGEN_PRIVATE_KEY: ${{ secrets.PROXYGEN_PRIVATE_KEY }}
104+
run: |
105+
mkdir -p ~/.proxygen
106+
echo "$PROXYGEN_PRIVATE_KEY" > ~/.proxygen/eligibility-signposting-api.pem
107+
make setup-proxygen-credentials
108+
- name: Generate specification
109+
run: |
110+
make construct-spec APIM_ENV=sandbox
111+
112+
- name: Publish sandbox spec to Proxygen
113+
run: |
114+
proxygen spec publish build/specification/sandbox/eligibility-signposting-api.yaml --no-confirm
115+
116+
- name: Deploy sandbox spec to Proxygen
117+
run: |
118+
proxygen instance deploy sandbox eligibility-signposting-api build/specification/sandbox/eligibility-signposting-api.yaml --no-confirm
119+
120+
publish_postman:
121+
needs: sandbox
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@v6
125+
- name: Install dependencies
126+
run: make install
127+
- name: Generate Postman Collection
128+
run: make convert-postman
129+
- name: Publish Postman Collection
130+
env:
131+
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}
132+
run: |
133+
curl --fail -X PUT \
134+
https://api.getpostman.com/collections/{{YOUR_COLLECTION_UID}} \
135+
-H "X-Api-Key: $POSTMAN_API_KEY" \
136+
-H "Content-Type: application/json" \
137+
-d @specification/postman/collection.json
138+
139+
publish:
140+
needs: publish_postman
141+
runs-on: ubuntu-latest
142+
steps:
143+
- name: "Tag the dev & sandbox deployment"
144+
run: |
145+
git config user.name "github-actions"
146+
git config user.email "github-actions@github.com"
147+
git tag ${{ needs.metadata.outputs.version }}
148+
git push origin ${{ needs.metadata.outputs.version }}
149+
150+
notify_slack:
151+
needs: publish
152+
runs-on: ubuntu-latest
153+
steps:
154+
- name: "Notify Slack on PR merge"
155+
uses: slackapi/slack-github-action@v2.1.1
156+
with:
157+
webhook: ${{ secrets.SLACK_WORKFLOW_WEBHOOK_URL }}
158+
webhook-type: webhook-trigger
159+
payload: |
160+
status: "${{ job.status }}"
161+
link: "https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
162+
triggered_by: "${{ github.actor }}"
163+
environment: "Specification updated in Dev & Sandbox"
164+
version: "${{ needs.metadata.outputs.version }}"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy to Preprod
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: "Tag to promote (e.g. spec-{timestamp})"
8+
default: latest
9+
required: true
10+
11+
jobs:
12+
preprod:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
- name: Set tag to deploy
17+
id: set_tag
18+
run: |
19+
if [ "${{ github.event.inputs.ref }}" = "latest" ]; then
20+
TAG=$(git tag --list 'spec-*' --sort=-v:refname | head -n 1)
21+
echo "Using latest tag: $TAG"
22+
echo "tag=$TAG" >> $GITHUB_OUTPUT
23+
else
24+
echo "tag=${{ github.event.inputs.ref }}" >> $GITHUB_OUTPUT
25+
fi
26+
- name: Checkout tag
27+
uses: actions/checkout@v6
28+
with:
29+
ref: ${{ steps.set_tag.outputs.tag }}
30+
- uses: actions/setup-python@v6
31+
with:
32+
python-version: '3.11'
33+
- uses: actions/setup-node@v6
34+
with:
35+
node-version: '20'
36+
- run: make install
37+
- run: make construct-spec APIM_ENV=preprod
38+
- run: make publish-spec APIM_ENV=preprod
39+
- run: make deploy-spec APIM_ENV=preprod

0 commit comments

Comments
 (0)