This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
build(deps): bump aws-sdk from 2.1428.0 to 2.1429.0 (#272) #278
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Stage | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
stage: | |
runs-on: ubuntu-latest | |
environment: staging | |
name: Stage the project | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Install node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: npm | |
- name: Configure aws | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Install project modules | |
run: npm ci --production | |
- name: Create lambda archive | |
run: zip -r github-management-scripts.zip src/ node_modules/ | |
- name: Get function state | |
id: function_state | |
run: | | |
state=$(aws lambda get-function --function-name ${{ secrets.LAMBDA_FUNCTION }} --query 'Configuration.State' --output text) | |
echo '::set-output name=state::'"$state" | |
- name: Verify function is in active state | |
if: steps.function_state.outputs.state != 'Active' | |
uses: actions/github-script@v6 | |
with: | |
script: core.setFailed('the function is being updated, please try again later') | |
- name: Deploy archive to lambda | |
run: > | |
aws lambda update-function-code | |
--function-name ${{ secrets.LAMBDA_FUNCTION }} | |
--zip-file fileb://./github-management-scripts.zip | |
- name: Wait for function to be updated | |
run: aws lambda wait function-updated --function-name ${{ secrets.LAMBDA_FUNCTION }} | |
- name: Publish lambda function | |
id: publish_lambda | |
run: | | |
set -o pipefail | |
function_version=$(aws lambda publish-version --function-name ${{ secrets.LAMBDA_FUNCTION }} | jq -r ".Version") | |
echo '::set-output name=function_version::'"$function_version" | |
- name: Update alias Dev with new function version | |
run: > | |
aws lambda update-alias | |
--function-name ${{ secrets.LAMBDA_FUNCTION }} | |
--name Dev | |
--function-version ${{ steps.publish_lambda.outputs.function_version }} |