update lock #412
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 (AWS) | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: # don't trigger if all changes matches these paths | |
- 'azure/**' | |
- '**.md' | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
permissions: | |
contents: write # we don't write, but we need this to read secrets | |
defaults: | |
run: | |
working-directory: aws/ | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
deploy: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: master | |
persist-credentials: false | |
- name: Mask variables | |
run: | | |
echo "::add-mask::${{ secrets.AWS_ACCOUNT_ID }}" | |
echo "::add-mask::${{ secrets.AWS_API_GATEWAY_ID }}" | |
echo "::add-mask::${{ secrets.AWS_API_GATEWAY_ID2 }}" | |
echo "::add-mask::${{ secrets.AWS_DEPLOY_USER_NAME }}" | |
- name: Read .nvmrc | |
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | |
id: nvm | |
- name: Use Node.js ${{ steps.nvm.outputs.NVMRC }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "${{ steps.nvm.outputs.NVMRC }}" | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Setup test | |
run: bash ci/test-setup.sh | |
- name: Test | |
run: yarn run test:ci | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
role-to-assume: ap2020bot-deploy-limited-prod | |
role-duration-seconds: 1200 | |
- name: Deploy | |
run: yarn run serverless deploy --stage prod | |
- uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
text: ":rocket: *ap2020bot (AWS)* Deploy: *Failed* :x:" | |
fields: message,commit,ref,workflow | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_AWS }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: failure() | |
- uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
text: ":rocket: *ap2020bot (AWS)* Deploy: *Success* :white_check_mark:" | |
fields: message,commit,ref,workflow | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_AWS }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: success() |