39: Update Lambda runtime and deployment workflow (#49) #168
This file contains hidden or 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: Deployment | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| DEPLOY_PROD: | |
| type: boolean | |
| default: false | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| id-token: write | |
| contents: read | |
| packages: write | |
| concurrency: deploy | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| - run: npm ci | |
| - run: npm test | |
| deploy-dev: | |
| name: Deploy-dev | |
| needs: Build | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| - uses: actions/setup-python@v3 | |
| - uses: aws-actions/setup-sam@v2 | |
| - uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-region: us-east-1 | |
| role-to-assume: ${{ secrets.DEV_ROLE_ARN }} | |
| role-session-name: DeployToDev | |
| - run: sam build --use-container | |
| - run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --parameter-overrides SlackTokenSecret=${{ secrets.SLACKTOKEN }} SmallImprovementsTokenSecret=${{ secrets.SITOKEN }} | |
| deploy-prod: | |
| name: Deploy-prod | |
| needs: Deploy-dev | |
| if: ${{ inputs.DEPLOY_PROD }} | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| - uses: actions/setup-python@v3 | |
| - uses: aws-actions/setup-sam@v2 | |
| - uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-region: us-east-1 | |
| role-to-assume: ${{ secrets.PROD_ROLE_ARN }} | |
| role-session-name: DeployToProd | |
| - run: sam build --use-container | |
| - run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --parameter-overrides SlackTokenSecret=${{ secrets.SLACKTOKEN }} SmallImprovementsTokenSecret=${{ secrets.SITOKEN }} SlackChannel=CF4U95FN0 ScheduleEnabled=true |