Skip to content

Commit f647154

Browse files
committed
Automated the layer version increment process
1 parent 551c34c commit f647154

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
@@ -41,11 +40,6 @@ on:
4140
type: string
4241
required: true
4342

44-
layer_version:
45-
description: Layer version
46-
type: string
47-
required: true
48-
4943
name: SSM Parameters
5044
run-name: SSM Parameters - TypeScript
5145

@@ -107,15 +101,22 @@ jobs:
107101
# Dynamic secret access is safe here - secrets are scoped per environment
108102
role-to-assume: ${{ secrets[format('{0}', steps.transform.outputs.CONVERTED_REGION)] }}
109103
mask-aws-account-id: true
104+
- id: get-version
105+
env:
106+
prefix: ${{ inputs.environment == 'beta' && '/aws/service/powertools/beta' || '/aws/service/powertools' }}
107+
run: |
108+
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)
109+
new_layer_version=$((current_layer_version + 1))
110+
echo "new_layer_version=$new_layer_version" >> "$GITHUB_OUTPUT"
110111
- id: write-version
111112
env:
112113
prefix: ${{ inputs.environment == 'beta' && '/aws/service/powertools/beta' || '/aws/service/powertools' }}
113114
run: |
114-
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
115+
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
115116
116117
- id: write-latest
117118
if: inputs.write_latest == true
118119
env:
119120
prefix: ${{ inputs.environment == 'beta' && '/aws/service/powertools/beta' || '/aws/service/powertools' }}
120121
run: |
121-
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
122+
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)