diff --git a/.github/scripts/update_layer_arn.sh b/.github/scripts/update_layer_arn.sh index 0679c4cd33..3a39f3135b 100755 --- a/.github/scripts/update_layer_arn.sh +++ b/.github/scripts/update_layer_arn.sh @@ -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 " +# Get the new layer arn from the first command-line argument +new_layer_arn=$1 +if [ -z "$new_layer_arn" ]; then + echo "Usage: $0 " 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) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index bec1e0d654..be173d78f1 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -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 @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/publish_layer.yml b/.github/workflows/publish_layer.yml index d88fe78673..9b59b6791f 100644 --- a/.github/workflows/publish_layer.yml +++ b/.github/workflows/publish_layer.yml @@ -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: @@ -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 @@ -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 diff --git a/.github/workflows/reusable_deploy_layer_stack.yml b/.github/workflows/reusable_deploy_layer_stack.yml index e8ea6aa4ca..f4bf2955ba 100644 --- a/.github/workflows/reusable_deploy_layer_stack.yml +++ b/.github/workflows/reusable_deploy_layer_stack.yml @@ -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 @@ -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 @@ -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