Merge pull request #15 from Geode-solutions/next #118
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: Deploy to AWS Lambda | |
on: | |
push: | |
branches: [ master, next ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Test | |
run: | | |
pip install pytest | |
pytest -v tests | |
- name: Configure AWS credentials from Test account | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
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: Zip code | |
run: | | |
cd lambda_function | |
zip -r ../lambda_function.zip . | |
- name: Update Lambda function code | |
run: | | |
JSON_RETURN=$(aws lambda update-function-code --function-name L_Global_CreateBackend --zip-file fileb://lambda_function.zip --publish) | |
FUNCTION_VERSION=`echo "$JSON_RETURN" | jq '.Version'` | |
FUNCTION_VERSION=`echo "${FUNCTION_VERSION:1:${#FUNCTION_VERSION}-2}"` | |
echo $FUNCTION_VERSION | |
aws lambda update-alias --function-name L_Global_CreateBackend --name ${GITHUB_REF##*/} --function-version $FUNCTION_VERSION |