26
26
jobs :
27
27
build-layer :
28
28
permissions :
29
+ # lower privilege propagated from parent workflow (release.yml)
29
30
contents : read
30
31
id-token : none
31
32
pages : none
88
89
# lower privilege propagated from parent workflow (release.yml)
89
90
permissions :
90
91
id-token : write
91
- contents : write
92
- pull-requests : write
93
- pages : write
92
+ contents : read
94
93
uses : ./.github/workflows/reusable_deploy_v2_layer_stack.yml
95
94
secrets : inherit
96
95
with :
@@ -104,9 +103,7 @@ jobs:
104
103
# lower privilege propagated from parent workflow (release.yml)
105
104
permissions :
106
105
id-token : write
107
- contents : write
108
- pull-requests : write
109
- pages : write
106
+ contents : read
110
107
uses : ./.github/workflows/reusable_deploy_v2_layer_stack.yml
111
108
secrets : inherit
112
109
with :
@@ -147,6 +144,50 @@ jobs:
147
144
environment : " layer-prod"
148
145
package-version : ${{ inputs.latest_published_version }}
149
146
147
+ # Updating the documentation with the latest Layer ARNs is a two-phase process
148
+ #
149
+ # 1. Update layer ARNs with latest deployed locally and create a PR with these changes
150
+ # 2. Pull from temporary branch with these changes and update the docs we're releasing
151
+ #
152
+ # This keeps our permissions tight and we don't run into a conflict,
153
+ # where a new release creates a new doc (2.16.0) while layers are still pointing to 2.15
154
+ # because the PR has to be merged while release process is running
155
+
156
+ update_v2_layer_arn_docs :
157
+ needs : prod
158
+ outputs :
159
+ temp_branch : ${{ steps.create-pr.outputs.temp_branch }}
160
+ runs-on : ubuntu-latest
161
+ permissions :
162
+ # lower privilege propagated from parent workflow (release.yml)
163
+ contents : write
164
+ pull-requests : write
165
+ id-token : none
166
+ pages : none
167
+ steps :
168
+ - name : Checkout repository # reusable workflows start clean, so we need to checkout again
169
+ uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
170
+ with :
171
+ fetch-depth : 0
172
+ - name : Download CDK layer artifact
173
+ uses : actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
174
+ with :
175
+ name : cdk-layer-stack
176
+ path : cdk-layer-stack/
177
+ - name : Replace layer versions in documentation
178
+ run : |
179
+ ls -la cdk-layer-stack/
180
+ ./layer/scripts/update_layer_arn.sh cdk-layer-stack
181
+ - name : Create PR
182
+ id : create-pr
183
+ uses : ./.github/actions/create-pr
184
+ with :
185
+ files : " docs/index.md examples"
186
+ temp_branch_prefix : " ci-layer-docs"
187
+ pull_request_title : " chore(ci): layer docs update"
188
+ github_token : ${{ secrets.GITHUB_TOKEN }}
189
+
190
+
150
191
prepare_docs_alias :
151
192
runs-on : ubuntu-latest
152
193
permissions :
@@ -167,16 +208,16 @@ jobs:
167
208
fi
168
209
echo DOCS_ALIAS="$DOCS_ALIAS" >> "$GITHUB_OUTPUT"
169
210
170
- release-docs :
171
- needs : [prod , prepare_docs_alias]
211
+ release_docs :
212
+ needs : [update_v2_layer_arn_docs , prepare_docs_alias]
172
213
permissions :
173
214
# lower privilege propagated from parent workflow (release.yml)
174
215
contents : write
175
216
pages : write
176
- id-token : write
177
217
pull-requests : none
218
+ id-token : none
178
219
uses : ./.github/workflows/reusable_publish_docs.yml
179
220
with :
180
221
version : ${{ inputs.latest_published_version }}
181
222
alias : ${{ needs.prepare_docs_alias.outputs.DOCS_ALIAS }}
182
- detached_mode : true
223
+ git_ref : ${{ needs.update_v2_layer_arn_docs.outputs.temp_branch }}
0 commit comments