6
6
- develop
7
7
- feat/ordhook-sdk-js
8
8
paths-ignore :
9
- - ' **/CHANGELOG.md'
9
+ - " **/CHANGELOG.md"
10
10
pull_request :
11
11
workflow_dispatch :
12
12
13
13
concurrency :
14
14
group : ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}
15
15
cancel-in-progress : true
16
16
17
+ env :
18
+ DOCKER_IMAGE : hirosystems/${{ github.event.repository.name }}
19
+
17
20
jobs :
18
21
test :
19
22
runs-on : ubuntu-latest
41
44
- name : Upload coverage reports to Codecov
42
45
uses : codecov/codecov-action@v3
43
46
env :
44
- CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
47
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
45
48
46
49
build-publish :
47
50
runs-on : ubuntu-latest
84
87
uses : docker/metadata-action@v5
85
88
with :
86
89
images : |
87
- hirosystems/ ${{ github.event.repository.name }}
90
+ ${{ env.DOCKER_IMAGE }}
88
91
tags : |
89
92
type=ref,event=branch
90
93
type=ref,event=pr
@@ -115,27 +118,30 @@ jobs:
115
118
runs-on : ubuntu-latest
116
119
strategy :
117
120
matrix :
118
- k8s-env : [mainnet]
121
+ network : [mainnet]
122
+ subenv : [blue]
119
123
needs : build-publish
120
124
if : github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
121
125
env :
122
126
DEPLOY_ENV : dev
123
127
environment :
124
- name : Development-${{ matrix.k8s-env }}
128
+ name : Development-${{ matrix.network }}-${{ matrix.subenv }}
125
129
url : https://platform.dev.hiro.so/
126
130
steps :
127
131
- name : Checkout actions repo
128
132
uses : actions/checkout@v4
129
133
with :
130
- ref : main
134
+ ref : feat/subenvs
131
135
token : ${{ secrets.GH_TOKEN }}
132
136
repository : ${{ secrets.DEVOPS_ACTIONS_REPO }}
133
137
134
- - name : Deploy Ordhook build to Dev ${{ matrix.k8s-env }}
138
+ - name : Deploy Ordhook build to Dev ${{ matrix.network }} ${{ matrix.subenv }}
135
139
uses : ./actions/deploy
136
140
with :
137
- docker_tag : ${{ needs.build-publish.outputs.docker_image_digest }}
138
- file_pattern : manifests/bitcoin/${{ matrix.k8s-env }}/ordhook/${{ env.DEPLOY_ENV }}/base/kustomization.yaml
141
+ docker_image : ${{ env.DOCKER_IMAGE }}
142
+ docker_image_digest : ${{ needs.build-publish.outputs.docker_image_digest }}
143
+ dir_pattern : manifests/bitcoin/${{ matrix.network }}/ordhook/${{ env.DEPLOY_ENV }}
144
+ subenv : ${{ matrix.subenv }}
139
145
gh_token : ${{ secrets.GH_TOKEN }}
140
146
141
147
auto-approve-dev :
@@ -146,38 +152,40 @@ jobs:
146
152
- name : Approve pending deployments
147
153
run : |
148
154
sleep 5
149
- ENV_IDS =$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/hirosystems/ordhook/actions/runs/${{ github.run_id }}/pending_deployments" | jq -r '[.[ ].environment.id // empty] ')
155
+ ENV_ID =$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/hirosystems/ordhook/actions/runs/${{ github.run_id }}/pending_deployments" | jq -r '.[0 ].environment.id // empty')
150
156
if [[ "${ENV_IDS}" != "[]" ]]; then
151
- curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/hirosystems/ordhook/actions/runs/${{ github.run_id }}/pending_deployments" -d "{\"environment_ids\":${ENV_IDS} ,\"state\":\"approved\",\"comment\":\"auto approve\"}"
157
+ curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/hirosystems/ordhook/actions/runs/${{ github.run_id }}/pending_deployments" -d "{\"environment_ids\":[${ENV_ID}] ,\"state\":\"approved\",\"comment\":\"auto approve\"}"
152
158
fi
153
159
154
160
deploy-staging :
155
161
runs-on : ubuntu-latest
156
162
strategy :
157
163
matrix :
158
- k8s-env : [mainnet]
164
+ network : [mainnet]
165
+ subenv : [blue]
159
166
needs :
160
167
- build-publish
161
168
- deploy-dev
162
169
if : github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
163
170
env :
164
171
DEPLOY_ENV : stg
165
172
environment :
166
- name : Staging-${{ matrix.k8s-env }}
173
+ name : Staging-${{ matrix.network }}-${{ matrix.subenv }}
167
174
url : https://platform.stg.hiro.so/
168
175
steps :
169
176
- name : Checkout actions repo
170
177
uses : actions/checkout@v4
171
178
with :
172
- ref : main
179
+ ref : feat/subenvs
173
180
token : ${{ secrets.GH_TOKEN }}
174
181
repository : ${{ secrets.DEVOPS_ACTIONS_REPO }}
175
182
176
- - name : Deploy Chainhook build to Stg ${{ matrix.k8s-env }}
183
+ - name : Deploy Ordhook build to Stg ${{ matrix.network }} ${{ matrix.subenv }}
177
184
uses : ./actions/deploy
178
185
with :
179
- docker_tag : ${{ needs.build-publish.outputs.docker_image_digest }}
180
- file_pattern : manifests/bitcoin/${{ matrix.k8s-env }}/ordhook/${{ env.DEPLOY_ENV }}/base/kustomization.yaml
186
+ docker_image : ${{ env.DOCKER_IMAGE }}
187
+ docker_image_digest : ${{ needs.build-publish.outputs.docker_image_digest }}
188
+ file_pattern : manifests/bitcoin/${{ matrix.network }}/ordhook/${{ env.DEPLOY_ENV }}/base/kustomization.yaml
181
189
gh_token : ${{ secrets.GH_TOKEN }}
182
190
183
191
auto-approve-stg :
@@ -190,36 +198,38 @@ jobs:
190
198
- name : Approve pending deployments
191
199
run : |
192
200
sleep 5
193
- ENV_IDS =$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/hirosystems/ordhook/actions/runs/${{ github.run_id }}/pending_deployments" | jq -r '[.[ ].environment.id // empty] ')
201
+ ENV_ID =$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/hirosystems/ordhook/actions/runs/${{ github.run_id }}/pending_deployments" | jq -r '.[0 ].environment.id // empty')
194
202
if [[ "${ENV_IDS}" != "[]" ]]; then
195
- curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/hirosystems/ordhook/actions/runs/${{ github.run_id }}/pending_deployments" -d "{\"environment_ids\":${ENV_IDS} ,\"state\":\"approved\",\"comment\":\"auto approve\"}"
203
+ curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/hirosystems/ordhook/actions/runs/${{ github.run_id }}/pending_deployments" -d "{\"environment_ids\":[${ENV_ID}] ,\"state\":\"approved\",\"comment\":\"auto approve\"}"
196
204
fi
197
205
198
206
deploy-prod :
199
207
runs-on : ubuntu-latest
200
208
strategy :
201
209
matrix :
202
- k8s-env : [mainnet,testnet]
210
+ network : [mainnet]
211
+ subenv : [blue, green]
203
212
needs :
204
213
- build-publish
205
214
- deploy-staging
206
215
if : needs.build-publish.outputs.new_release_published == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
207
216
env :
208
217
DEPLOY_ENV : prd
209
218
environment :
210
- name : Production-${{ matrix.k8s-env }}
219
+ name : Production-${{ matrix.network }}-${{ matrix.subenv }}
211
220
url : https://platform.hiro.so/
212
221
steps :
213
222
- name : Checkout actions repo
214
223
uses : actions/checkout@v4
215
224
with :
216
- ref : main
225
+ ref : feat/subenvs
217
226
token : ${{ secrets.GH_TOKEN }}
218
227
repository : ${{ secrets.DEVOPS_ACTIONS_REPO }}
219
228
220
- - name : Deploy Ordhook build to Prd ${{ matrix.k8s-env }}
229
+ - name : Deploy Ordhook build to Prd ${{ matrix.network }} ${{ matrix.subenv }}
221
230
uses : ./actions/deploy
222
231
with :
223
- docker_tag : ${{ needs.build-publish.outputs.docker_image_digest }}
224
- file_pattern : manifests/bitcoin/${{ matrix.k8s-env }}/ordhook/${{ env.DEPLOY_ENV }}/base/kustomization.yaml
232
+ docker_image : ${{ env.DOCKER_IMAGE }}
233
+ docker_image_digest : ${{ needs.build-publish.outputs.docker_image_digest }}
234
+ file_pattern : manifests/bitcoin/${{ matrix.network }}/ordhook/${{ env.DEPLOY_ENV }}/base/kustomization.yaml
225
235
gh_token : ${{ secrets.GH_TOKEN }}
0 commit comments