Skip to content

Commit 4589cbf

Browse files
committed
Automated the layer version increment process
1 parent 8028978 commit 4589cbf

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

.github/workflows/update_ssm.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# * environment: will prefix /beta/ into the parameter
66
# * write_latest: will create a latest alias instead of a version number in the parameter
77
# * package_version: semantic version number of the released layer (3.x.y)
8-
# * layer_version: this is sequential layer version from the ARN
98
#
109
# A successful parameter would look similar to:
1110
# /aws/service/powertools/python/arm64/python3.8/3.1.0
@@ -33,11 +32,6 @@ on:
3332
type: string
3433
required: true
3534

36-
layer_version:
37-
description: Layer version
38-
type: string
39-
required: true
40-
4135
name: SSM Parameters
4236
run-name: SSM Parameters - TypeScript
4337

@@ -98,15 +92,22 @@ jobs:
9892
aws-region: ${{ matrix.region }}
9993
role-to-assume: ${{ secrets[format('{0}', steps.transform.outputs.CONVERTED_REGION)] }}
10094
mask-aws-account-id: true
95+
- id: get-version
96+
env:
97+
prefix: ${{ inputs.environment == 'beta' && '/aws/service/powertools/beta' || '/aws/service/powertools' }}
98+
run: |
99+
current_layer_version=$(aws ssm get-parameter --name ${{ env.prefix }}/typescript/generic/all/${{ inputs.package_version }} --query Parameter.Value --output text --region us-east-1)
100+
new_layer_version=$((current_layer_version + 1))
101+
echo "new_layer_version=$new_layer_version" >> "$GITHUB_OUTPUT"
101102
- id: write-version
102103
env:
103104
prefix: ${{ inputs.environment == 'beta' && '/aws/service/powertools/beta' || '/aws/service/powertools' }}
104105
run: |
105-
aws ssm put-parameter --name ${{ env.prefix }}/typescript/generic/all/${{ inputs.package_version }} --value "arn:aws:lambda:${{ matrix.region }}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:${{ inputs.layer_version }}" --type String --overwrite
106+
aws ssm put-parameter --name ${{ env.prefix }}/typescript/generic/all/${{ inputs.package_version }} --value "arn:aws:lambda:${{ matrix.region }}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:${{ steps.get-version.outputs.new_layer_version }}" --type String --overwrite
106107
107108
- id: write-latest
108109
if: inputs.write_latest == true
109110
env:
110111
prefix: ${{ inputs.environment == 'beta' && '/aws/service/powertools/beta' || '/aws/service/powertools' }}
111112
run: |
112-
aws ssm put-parameter --name ${{ env.prefix }}/typescript/generic/all/latest --value "arn:aws:lambda:${{ matrix.region }}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:${{ inputs.layer_version }}" --type String --overwrite
113+
aws ssm put-parameter --name ${{ env.prefix }}/typescript/generic/all/latest --value "arn:aws:lambda:${{ matrix.region }}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:${{ steps.get-version.outputs.new_layer_version }}" --type String --overwrite

docs/maintainers.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,12 @@ This will publish the Lambda layer to the AWS China (Beijing) Region.
191191
9. **Merge docs PR**: Once the `Layer Deployment (Partition)` workflow for the production China partition is complete,
192192
merge the PR from step 4 to update the documentation with the new version.
193193
10. **Update SSM Parameters (Beta)**: Run the `SSM Parameters` workflow with the `main` branch, targeting the `beta`
194-
deployment environment, and using the package version from npm (i.e., `2.20.0`) and Lambda layer version from step 4.
194+
deployment environment, and using the package version from npm (i.e., `2.20.0`).
195195
This will update the SSM parameters with the new version.
196-
11. **Verify SSM Parameters (Beta)**: Use the AWS CLI to verify that the SSM parameters were updated correctly. Run
197-
the following command: `aws ssm get-parameter --name=/aws/service/powertools/beta/typescript/generic/all/latest`
198-
and `aws ssm get-parameter --name=/aws/service/powertools/beta/typescript/generic/all/<version>` to verify that the
199-
SSM parameters were updated correctly.
200-
12. **Update SSM Parameters (Prod)**: Run the `SSM Parameters` workflow with the `main` branch, targeting the `prod`
201-
deployment environment, and using the package version from npm (i.e., `2.20.0`) and Lambda layer version from step 4.
196+
11. **Update SSM Parameters (Prod)**: Run the `SSM Parameters` workflow with the `main` branch, targeting the `prod`
197+
deployment environment, and using the package version from npm (i.e., `2.20.0`).
202198
This will update the SSM parameters with the new version.
203-
13. **Verify SSM Parameters (Prod)**: Use the AWS CLI to verify that the SSM parameters were updated correctly. Run
204-
the following command: `aws ssm get-parameter --name=/aws/service/powertools/typescript/generic/all/latest`
205-
and `aws ssm get-parameter --name=/aws/service/powertools/typescript/generic/all/<version>` to verify that the
206-
SSM parameters were updated correctly.
207-
14. **Update Docs**: Run the `Rebuild latest docs` workflow with the `main` branch using the package version from
199+
12. **Update Docs**: Run the `Rebuild latest docs` workflow with the `main` branch using the package version from
208200
npm (i.e. `2.20.0`). This will update the documentation with the new version.
209201

210202
Once complete, you can start drafting the release notes to let customers know **what changed and what's in it for them (a.k.a why they should care)**. We have guidelines in the release notes section so you know what good looks like.

0 commit comments

Comments
 (0)