1
1
name : Deploy v2 layer to all regions
2
2
3
- permissions :
4
- id-token : write
5
- contents : write
6
- pages : write
7
-
8
3
on :
9
4
workflow_dispatch :
10
5
inputs :
31
26
jobs :
32
27
build-layer :
33
28
permissions :
29
+ # lower privilege propagated from parent workflow (release.yml)
34
30
contents : read
31
+ id-token : none
32
+ pages : none
33
+ pull-requests : none
35
34
runs-on : aws-lambda-powertools_ubuntu-latest_8-core
36
35
defaults :
37
36
run :
87
86
88
87
beta :
89
88
needs : build-layer
89
+ # lower privilege propagated from parent workflow (release.yml)
90
+ permissions :
91
+ id-token : write
92
+ contents : read
93
+ pages : write # docs will be updated with latest Layer ARNs
94
+ pull-requests : write # creation-action will create a PR with Layer ARN updates
90
95
uses : ./.github/workflows/reusable_deploy_v2_layer_stack.yml
91
96
secrets : inherit
92
97
with :
@@ -97,6 +102,12 @@ jobs:
97
102
98
103
prod :
99
104
needs : beta
105
+ # lower privilege propagated from parent workflow (release.yml)
106
+ permissions :
107
+ id-token : write
108
+ contents : read
109
+ pages : write # docs will be updated with latest Layer ARNs
110
+ pull-requests : write # creation-action will create a PR with Layer ARN updates
100
111
uses : ./.github/workflows/reusable_deploy_v2_layer_stack.yml
101
112
secrets : inherit
102
113
with :
@@ -107,6 +118,12 @@ jobs:
107
118
108
119
sar-beta :
109
120
needs : build-layer
121
+ permissions :
122
+ # lower privilege propagated from parent workflow (release.yml)
123
+ id-token : write
124
+ contents : read
125
+ pull-requests : none
126
+ pages : none
110
127
uses : ./.github/workflows/reusable_deploy_v2_sar.yml
111
128
secrets : inherit
112
129
with :
@@ -117,6 +134,12 @@ jobs:
117
134
118
135
sar-prod :
119
136
needs : [build-layer, sar-beta]
137
+ permissions :
138
+ # lower privilege propagated from parent workflow (release.yml)
139
+ id-token : write
140
+ contents : read
141
+ pull-requests : none
142
+ pages : none
120
143
uses : ./.github/workflows/reusable_deploy_v2_sar.yml
121
144
secrets : inherit
122
145
with :
@@ -125,10 +148,62 @@ jobs:
125
148
environment : " layer-prod"
126
149
package-version : ${{ inputs.latest_published_version }}
127
150
151
+ # Updating the documentation with the latest Layer ARNs is a two-phase process
152
+ #
153
+ # 1. Update layer ARNs with latest deployed locally and create a PR with these changes
154
+ # 2. Pull from temporary branch with these changes and update the docs we're releasing
155
+ #
156
+ # This keeps our permissions tight and we don't run into a conflict,
157
+ # where a new release creates a new doc (2.16.0) while layers are still pointing to 2.15
158
+ # because the PR has to be merged while release process is running
159
+
160
+ update_v2_layer_arn_docs :
161
+ needs : prod
162
+ outputs :
163
+ temp_branch : ${{ steps.create-pr.outputs.temp_branch }}
164
+ runs-on : ubuntu-latest
165
+ permissions :
166
+ # lower privilege propagated from parent workflow (release.yml)
167
+ contents : write
168
+ pull-requests : write
169
+ id-token : none
170
+ pages : none
171
+ steps :
172
+ - name : Checkout repository # reusable workflows start clean, so we need to checkout again
173
+ uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
174
+ with :
175
+ fetch-depth : 0
176
+ - name : Download CDK layer artifact
177
+ uses : actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
178
+ with :
179
+ name : cdk-layer-stack
180
+ path : cdk-layer-stack/
181
+ - name : Replace layer versions in documentation
182
+ run : |
183
+ ls -la cdk-layer-stack/
184
+ ./layer/scripts/update_layer_arn.sh cdk-layer-stack
185
+ # NOTE: It felt unnecessary creating yet another PR to update changelog w/ latest tag
186
+ # since this is the only step in the release where we update docs from a temp branch
187
+ - name : Update changelog with latest tag
188
+ run : make changelog
189
+ - name : Create PR
190
+ id : create-pr
191
+ uses : ./.github/actions/create-pr
192
+ with :
193
+ files : " docs/index.md examples CHANGELOG.md"
194
+ temp_branch_prefix : " ci-layer-docs"
195
+ pull_request_title : " chore(ci): layer docs update"
196
+ github_token : ${{ secrets.GITHUB_TOKEN }}
197
+
198
+
128
199
prepare_docs_alias :
129
200
runs-on : ubuntu-latest
130
201
permissions :
202
+ # lower privilege propagated from parent workflow (release.yml)
131
203
contents : read
204
+ pages : none
205
+ id-token : none
206
+ pull-requests : none
132
207
outputs :
133
208
DOCS_ALIAS : ${{ steps.set-alias.outputs.DOCS_ALIAS }}
134
209
steps :
@@ -141,13 +216,16 @@ jobs:
141
216
fi
142
217
echo DOCS_ALIAS="$DOCS_ALIAS" >> "$GITHUB_OUTPUT"
143
218
144
- release-docs :
145
- needs : [prod , prepare_docs_alias]
219
+ release_docs :
220
+ needs : [update_v2_layer_arn_docs , prepare_docs_alias]
146
221
permissions :
222
+ # lower privilege propagated from parent workflow (release.yml)
147
223
contents : write
148
224
pages : write
225
+ pull-requests : none
226
+ id-token : none
149
227
uses : ./.github/workflows/reusable_publish_docs.yml
150
228
with :
151
229
version : ${{ inputs.latest_published_version }}
152
230
alias : ${{ needs.prepare_docs_alias.outputs.DOCS_ALIAS }}
153
- detached_mode : true
231
+ git_ref : ${{ needs.update_v2_layer_arn_docs.outputs.temp_branch }}
0 commit comments