-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (57 loc) · 1.73 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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@v4
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@v4
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 }}