From 7cb06bd43e3890586c71c516acbcab8916e3da20 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 25 Nov 2023 16:27:48 +0000 Subject: [PATCH 1/3] Store architecture in artifact Store the architecture in the deployment artifact so that the deployment workflow deploys what it was configured for, not what's defined in the deployment workflow in the main branch. --- .github/workflows/build.yml | 3 ++- .github/workflows/deploy.yml | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f70015a..b31510e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,7 +87,8 @@ jobs: then chmod +x ./bootstrap fi - zip -r "../../../${LAMBDA_FUNCTION}.zip" . || exit 1 + echo "${LAMBDA_ARCHITECTURES}" >> "LAMBDA_ARCHITECTURES" + zip -r "../../../${LAMBDA_FUNCTION}.zip" . "LAMBDA_ARCHITECTURES" || exit 1 - name: Publish deployment package uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a2d36c79..7c9458d4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,6 +27,7 @@ jobs: comment-id: ${{ steps.post-comment.outputs.result }} environment-name: ${{ steps.set-outputs.outputs.environment-name }} environment-url: ${{ steps.set-outputs.outputs.environment-url }} + function-architectures: ${{ steps.set-outputs.outputs.function-architectures }} function-description: ${{ steps.set-outputs.outputs.function-description }} function-name: ${{ steps.set-outputs.outputs.function-name }} ref: ${{ steps.set-outputs.outputs.ref }} @@ -171,9 +172,12 @@ jobs: - name: Set outputs id: set-outputs + env: + LAMBDA_ARCHITECTURES_FILE: '${{ steps.extract-artifact.outputs.lambda-artifact-path }}/LAMBDA_ARCHITECTURES' run: | environment_name="${{ steps.get-environment-name.outputs.result }}" environment_url="${{ github.server_url }}/${{ github.repository }}/deployments/${environment_name}" + function_architectures="$(cat ${LAMBDA_ARCHITECTURES_FILE})" function_description="Deploy build ${{ steps.download-artifact.outputs.run-number }} to AWS Lambda via GitHub Actions" ref="${{ steps.download-artifact.outputs.ref }}" workflow_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" @@ -188,6 +192,7 @@ jobs: { echo "environment-name=${environment_name}" echo "environment-url=${environment_url}" + echo "function-architectures=${function_architectures}" echo "function-description=${function_description}" echo "function-name=${function_name}" echo "ref=${ref}" @@ -228,7 +233,7 @@ jobs: env: FUNCTION_NAME: ${{ needs.setup.outputs.function-name }} - LAMBDA_ARCHITECTURES: 'arm64' + LAMBDA_ARCHITECTURES: ${{ needs.setup.outputs.function-function-architectures }} LAMBDA_DESCRIPTION: ${{ needs.setup.outputs.function-description }} LAMBDA_HANDLER: 'LondonTravel.Skill::MartinCostello.LondonTravel.Skill.AlexaFunctionHandler::HandleAsync' LAMBDA_MEMORY: 192 From e608074d770369c40d1d79fa193ef3759ccd198a Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Sat, 25 Nov 2023 16:29:40 +0000 Subject: [PATCH 2/3] Fix typo Fix copy-pasta typo. --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7c9458d4..90542708 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -233,7 +233,7 @@ jobs: env: FUNCTION_NAME: ${{ needs.setup.outputs.function-name }} - LAMBDA_ARCHITECTURES: ${{ needs.setup.outputs.function-function-architectures }} + LAMBDA_ARCHITECTURES: ${{ needs.setup.outputs.function-architectures }} LAMBDA_DESCRIPTION: ${{ needs.setup.outputs.function-description }} LAMBDA_HANDLER: 'LondonTravel.Skill::MartinCostello.LondonTravel.Skill.AlexaFunctionHandler::HandleAsync' LAMBDA_MEMORY: 192 From 9df0a07c4e20cb5406148a47dd6aabfb22b3dfb1 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Sat, 25 Nov 2023 16:30:55 +0000 Subject: [PATCH 3/3] Fix shellcheck warning Quote the path. --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 90542708..e8e1e382 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -177,7 +177,7 @@ jobs: run: | environment_name="${{ steps.get-environment-name.outputs.result }}" environment_url="${{ github.server_url }}/${{ github.repository }}/deployments/${environment_name}" - function_architectures="$(cat ${LAMBDA_ARCHITECTURES_FILE})" + function_architectures="$(cat "${LAMBDA_ARCHITECTURES_FILE}")" function_description="Deploy build ${{ steps.download-artifact.outputs.run-number }} to AWS Lambda via GitHub Actions" ref="${{ steps.download-artifact.outputs.ref }}" workflow_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"