Skip to content
9 changes: 5 additions & 4 deletions .github/scripts/update_layer_arn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
# see .github/workflows/publish_layer.yml


# Get the new version number from the first command-line argument
new_version=$1
if [ -z "$new_version" ]; then
echo "Usage: $0 <new_version>"
# Get the new layer arn from the first command-line argument
new_layer_arn=$1
if [ -z "$new_layer_arn" ]; then
echo "Usage: $0 <new_layer_arn>"
exit 1
fi
new_version=$(echo $new_layer_arn | sed 's/.*://')

# Find all files with specified extensions in ./docs and ./examples directories
# -type f: only find files (not directories)
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ name: Make Release
# 4. Merge the PR created by the `publish_layer` workflow to update the documentation
# 5. Update draft release notes with the latest changes and publish the release on GitHub

on:
workflow_dispatch:
inputs:
layer_documentation_version:
description: "Lambda layer version to be updated in our documentation. e.g. if the current layer number is 3, this value must be 4."
type: string
required: true
on: workflow_dispatch

permissions:
contents: read
Expand Down Expand Up @@ -105,5 +99,4 @@ jobs:
pull-requests: write
uses: ./.github/workflows/publish_layer.yml
with:
latest_published_version: ${{ needs.publish-npm.outputs.RELEASE_VERSION }}
layer_documentation_version: ${{ inputs.layer_documentation_version }}
latest_published_version: ${{ needs.publish-npm.outputs.RELEASE_VERSION }}
9 changes: 1 addition & 8 deletions .github/workflows/publish_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
description: "Latest npm published version to rebuild corresponding layer for, e.g. 1.0.2"
default: "1.0.2"
required: true
layer_documentation_version:
description: "Version to be updated in our documentation. e.g. if the current layer number is 3, this value must be 4."
required: true

workflow_call:
inputs:
Expand All @@ -26,10 +23,6 @@ on:
default: false
type: boolean
required: false
layer_documentation_version:
description: "Version to be updated in our documentation. e.g. if the current layer number is 3, this value must be 4."
required: true
type: string

jobs:
# Build layer by running cdk synth in layer-publisher directory and uploading cdk.out for deployment
Expand Down Expand Up @@ -105,7 +98,7 @@ jobs:
ref: ${{ github.sha }}
- name: Replace layer versions in documentation
run: |
./.github/scripts/update_layer_arn.sh ${{ inputs.layer_documentation_version }}
./.github/scripts/update_layer_arn.sh ${{ needs.deploy-prod.outputs.layer-arn }}
- name: Stage changes
run: git add .
- name: Create PR
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/reusable_deploy_layer_stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: "Latest version that is published"
required: true
type: string
outputs:
layer-arn:
description: "The latest deployed Layer ARN"
value: ${{ jobs.deploy-cdk-stack.outputs.layer-arn }}
secrets:
target-account-role:
required: true
Expand Down Expand Up @@ -65,6 +69,8 @@ jobs:
"il-central-1",
"mx-central-1"
]
outputs:
layer-arn: ${{ steps.store-latest-layer-arn.outputs.layer-arn }}
steps:
- name: checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand All @@ -89,11 +95,16 @@ jobs:
- name: Deploy Layer
run: npm run cdk -w layers -- deploy --app cdk.out --context region=${{ matrix.region }} 'LayerPublisherStack' --require-approval never --verbose --outputs-file cdk-outputs.json
- name: Store latest Layer ARN
id: store-latest-layer-arn
if: ${{ inputs.stage == 'PROD' }}
run: |
mkdir cdk-layer-stack
jq -r -c '.LayerPublisherStack.LatestLayerArn' layers/cdk-outputs.json > cdk-layer-stack/${{ matrix.region }}-layer-version.txt
cat cdk-layer-stack/${{ matrix.region }}-layer-version.txt
if [ "${{ matrix.region }}" = "us-east-1" ]; then
echo "layer-arn=$(cat cdk-layer-stack/${{ matrix.region }}-layer-version.txt)" | tee -a "$GITHUB_OUTPUT"
else
cat cdk-layer-stack/${{ matrix.region }}-layer-version.txt
fi
- name: Save Layer ARN artifact
if: ${{ inputs.stage == 'PROD' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
Expand Down