SRF Deployment #22
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: SRF Deployment | |
on: | |
workflow_dispatch: | |
inputs: | |
stage: | |
description: 'Stage (test|stage|production)' | |
required: true | |
jobs: | |
build_and_deploy: | |
name: Build and Deploy ${{ github.event.inputs.stage }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '12' | |
- name: build | |
run: | | |
npm install . | |
mkdir -v build | |
zip -9vr build/scanii-lambda.zip lib/ node_modules/ package* README.md LICENSE | |
- name: install AWS cli DEV | |
if: ${{ github.event.inputs.stage == 'test' }} | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: ${{ secrets.AWS_REGION }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} | |
- name: install AWS cli INT | |
if: ${{ github.event.inputs.stage == 'stage' }} | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: ${{ secrets.AWS_REGION }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_INT }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_INT }} | |
- name: install AWS cli PRD | |
if: ${{ github.event.inputs.stage == 'production' }} | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: ${{ secrets.AWS_REGION }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PRD }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PRD }} | |
- name: deploy | |
run: | | |
aws s3 cp build/scanii-lambda.zip s3://srf-deployment-s3-${{ github.event.inputs.stage }}/formio-scanii/latest.zip | |
aws lambda update-function-code --function-name formio-scanii-submit-${{ github.event.inputs.stage }} --s3-bucket srf-deployment-s3-${{ github.event.inputs.stage }} --s3-key formio-scanii/latest.zip | |
aws lambda update-function-code --function-name formio-scanii-callback-${{ github.event.inputs.stage }} --s3-bucket srf-deployment-s3-${{ github.event.inputs.stage }} --s3-key formio-scanii/latest.zip | |