-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (55 loc) · 1.39 KB
/
main.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
name: Lint, Build and Deploy
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
- name: Checkout repo
uses: actions/checkout@v4
- name: Audit dependencies
run: npm audit
- name: Install dependencies
run: npm ci
- name: Check code
run: npm run check
- name: Lint code
run: npm run lint
build:
name: Build and Deploy
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: lint
environment: aws-production
runs-on: ubuntu-latest
env:
AWS_REGION: eu-central-1
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
- name: Set up OpenTofu
uses: opentofu/setup-opentofu@v1
- name: Checkout repo
uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
- name: Deploy to production
run: npm run deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}