Skip to content

Merge pull request #406 from matushorvath/dependabot/npm_and_yarn/aws… #1108

Merge pull request #406 from matushorvath/dependabot/npm_and_yarn/aws…

Merge pull request #406 from matushorvath/dependabot/npm_and_yarn/aws… #1108

Workflow file for this run

name: Test and Deploy
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
test:
name: Build and Test
runs-on: ubuntu-22.04
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup cfn-lint
run: pip3 install --upgrade cfn-lint
- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install packages
run: npm install
- name: Run tests
run: npm test
- name: Report test coverage
# Actions run by dependabot are not allowed to update PRs
if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]'
uses: artiomtr/jest-coverage-report-action@v2.0-rc.6
with:
annotations: none
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: Deploy to AWS
runs-on: ubuntu-22.04
needs: test
if: github.ref == 'refs/heads/main'
environment: production
concurrency: deployment
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install packages
run: npm install --omit=dev --target_arch=arm64 --target_platform=linux
- name: Deploy to AWS
run: npm run deploy
env:
ADVENT_OF_CODE_SECRET: ${{ secrets.ADVENT_OF_CODE_SECRET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TELEGRAM_SECRET: ${{ secrets.TELEGRAM_SECRET }}
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}