11name : Deploy v2 layer to all regions
22
3- permissions :
4- id-token : write
5- contents : write
6- pages : write
7-
83on :
94 workflow_dispatch :
105 inputs :
3126jobs :
3227 build-layer :
3328 permissions :
29+ # lower privilege propagated from parent workflow (release.yml)
3430 contents : read
31+ id-token : none
32+ pages : none
33+ pull-requests : none
3534 runs-on : aws-lambda-powertools_ubuntu-latest_8-core
3635 defaults :
3736 run :
8786
8887 beta :
8988 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
9095 uses : ./.github/workflows/reusable_deploy_v2_layer_stack.yml
9196 secrets : inherit
9297 with :
@@ -97,6 +102,12 @@ jobs:
97102
98103 prod :
99104 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
100111 uses : ./.github/workflows/reusable_deploy_v2_layer_stack.yml
101112 secrets : inherit
102113 with :
@@ -107,6 +118,12 @@ jobs:
107118
108119 sar-beta :
109120 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
110127 uses : ./.github/workflows/reusable_deploy_v2_sar.yml
111128 secrets : inherit
112129 with :
@@ -117,6 +134,12 @@ jobs:
117134
118135 sar-prod :
119136 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
120143 uses : ./.github/workflows/reusable_deploy_v2_sar.yml
121144 secrets : inherit
122145 with :
@@ -125,10 +148,62 @@ jobs:
125148 environment : " layer-prod"
126149 package-version : ${{ inputs.latest_published_version }}
127150
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+
128199 prepare_docs_alias :
129200 runs-on : ubuntu-latest
130201 permissions :
202+ # lower privilege propagated from parent workflow (release.yml)
131203 contents : read
204+ pages : none
205+ id-token : none
206+ pull-requests : none
132207 outputs :
133208 DOCS_ALIAS : ${{ steps.set-alias.outputs.DOCS_ALIAS }}
134209 steps :
@@ -141,13 +216,16 @@ jobs:
141216 fi
142217 echo DOCS_ALIAS="$DOCS_ALIAS" >> "$GITHUB_OUTPUT"
143218
144- release-docs :
145- needs : [prod , prepare_docs_alias]
219+ release_docs :
220+ needs : [update_v2_layer_arn_docs , prepare_docs_alias]
146221 permissions :
222+ # lower privilege propagated from parent workflow (release.yml)
147223 contents : write
148224 pages : write
225+ pull-requests : none
226+ id-token : none
149227 uses : ./.github/workflows/reusable_publish_docs.yml
150228 with :
151229 version : ${{ inputs.latest_published_version }}
152230 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