-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdev_sandbox_publish_deploy.yaml
More file actions
186 lines (165 loc) · 5.72 KB
/
dev_sandbox_publish_deploy.yaml
File metadata and controls
186 lines (165 loc) · 5.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Deploy to Dev and Sandbox
on:
push:
branches:
- feature/rgjb-eli-604-rotate_proxygen_key_in_ptl_and_prod
jobs:
metadata:
name: "Set CI/CD metadata"
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
version: ${{ steps.variables.outputs.version }}
steps:
- name: "Set CI/CD variables"
id: variables
run: |
echo "version=spec-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: "List variables"
run: |
echo "Deploying to: DEV & Sandbox"
echo "VERSION=${{ steps.variables.outputs.version }}"
# internal-dev:
# name: "Publish spec & deploy to dev"
# needs: metadata
# runs-on: ubuntu-latest
# if: false # Skip this job
# steps:
# - name: Checkout repository
# uses: actions/checkout@v6
#
# - name: Set up Python 3.11
# uses: actions/setup-python@v6
# with:
# python-version: '3.11'
#
# - name: Set up Node.js
# uses: actions/setup-node@v6
# with:
# node-version: '20'
#
# - name: Install Poetry
# run: curl -sSL https://install.python-poetry.org | python3 -
#
# - name: Install Python and Node dependencies
# run: |
# make install
#
# - name: Install proxygen-cli
# run: |
# pip install proxygen-cli
#
# - name: Set up Proxygen credentials
# env:
# PROXYGEN_PRIVATE_KEY: ${{ secrets.PROXYGEN_PRIVATE_KEY_PTL }}
# run: |
# mkdir -p ~/.proxygen
# echo "$PROXYGEN_PRIVATE_KEY" > ~/.proxygen/eligibility-signposting-api.pem
# make setup-proxygen-credentials ENV=ptl
# - name: Generate specification
# run: |
# make construct-spec APIM_ENV=internal-dev
#
# - name: Deploy internal-dev spec to Proxygen
# run: |
# proxygen instance deploy internal-dev eligibility-signposting-api build/specification/internal-dev/eligibility-signposting-api.yaml --no-confirm
sandbox:
name: "Publish spec & deploy to sandbox"
needs: metadata # Changed from internal-dev to metadata
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Install Python and Node dependencies
run: |
make install
- name: Install proxygen-cli
run: |
pip install proxygen-cli
- name: Set up Proxygen credentials
env:
PROXYGEN_PRIVATE_KEY: ${{ secrets.PROXYGEN_PRIVATE_KEY_PROD }}
run: |
mkdir -p ~/.proxygen
echo "$PROXYGEN_PRIVATE_KEY" > ~/.proxygen/eligibility-signposting-api-prod.pem
make setup-proxygen-credentials ENV=prod
- name: Generate specification
run: |
make construct-spec APIM_ENV=sandbox
- name: Publish sandbox spec to Proxygen
run: |
proxygen spec publish build/specification/sandbox/eligibility-signposting-api.yaml --no-confirm
- name: Deploy sandbox spec to Proxygen
run: |
proxygen instance deploy sandbox eligibility-signposting-api build/specification/sandbox/eligibility-signposting-api.yaml --no-confirm
publish_postman:
name: "Publish to Postman"
needs: sandbox
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Install Python and Node dependencies
run: |
make install
- name: Generate Postman Collection
run: make convert-postman
- name: Publish Postman Collection
env:
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}
run: |
jq -c '{collection: .}' specification/postman/collection.json > wrapped_collection.json
curl -X PUT \
https://api.getpostman.com/collections/44595835-573a42db-b7a5-4b69-9f62-696b6df3f12f \
-H "X-Api-Key: $POSTMAN_API_KEY" \
-H "Content-Type: application/json" \
-d @wrapped_collection.json
tag_deployment:
name: "Tag Dev & Sandbox deployment"
needs: [metadata, publish_postman]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: "Tag the dev & sandbox deployment"
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag ${{ needs.metadata.outputs.version }}
git push origin ${{ needs.metadata.outputs.version }}
notify_slack:
name: "Notify Slack"
needs: tag_deployment
runs-on: ubuntu-latest
steps:
- name: "Notify Slack on PR merge"
uses: slackapi/slack-github-action@v2.1.1
with:
webhook: ${{ secrets.SLACK_WORKFLOW_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
status: "${{ job.status }}"
link: "https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
triggered_by: "${{ github.actor }}"
environment: "Specification updated in Dev & Sandbox"
version: "${{ needs.metadata.outputs.version }}"