-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.52 KB
/
frontend.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
name: Build and deploy front end
on:
push:
branches:
- main
- "*"
- "feature/*"
paths:
- 'frontend/**'
- '.github/workflows/frontend.yml'
pull_request:
branches: [ "main" ]
paths:
- 'frontend/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies and run tests
run: |
cd frontend
npm ci
# npm test
- name: Set environment variables
run: |
echo "VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}" >> $GITHUB_ENV
echo "VITE_COGNITO_DOMAIN=${{ secrets.VITE_COGNITO_DOMAIN }}" >> $GITHUB_ENV
echo "VITE_LOCAL_URL=${{ secrets.VITE_LOCAL_URL }}" >> $GITHUB_ENV
echo "VITE_CLIENT_ID=${{ secrets.VITE_CLIENT_ID }}" >> $GITHUB_ENV
echo "VITE_COGNITO_AUTHORITY=${{ secrets.VITE_COGNITO_AUTHORITY }}" >> $GITHUB_ENV
- name: Build React app
run: |
cd frontend
npm run build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY}}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Deploy to S3
run: |
aws s3 sync frontend/dist/ s3://${{ secrets.AWS_S3_BUCKET }}/ --delete