-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (79 loc) · 2.85 KB
/
web.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
72
73
74
75
76
77
78
79
name: Upload Web
on:
push:
branches:
- main
paths:
- "web/**"
- ".github/workflows/web.yml"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# checks out a copy of the repo
- uses: actions/checkout@main
with:
lfs: true
- name: Checkout lfs objects
run: git lfs checkout
- 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
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
# node yarn - cache
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Build web
id: build-web
run: |
cd web
yarn install
yarn run predeploy
cd -
env:
NEXT_PUBLIC_API_URL: api.ewaab.org
NEXT_PUBLIC_USE_SECURE: "true"
NEXT_PUBLIC_RECAPTCHA_SITE_KEY: ${{ secrets.NEXT_PUBLIC_RECAPTCHA_SITE_KEY }}
NEXT_PUBLIC_SITE_URL: https://network.ewaab.org
NEXT_PUBLIC_MODE: production
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }}
NEXT_PUBLIC_SENTRY_URL: ${{ secrets.NEXT_PUBLIC_SENTRY_URL }}
- name: Docker
id: docker-build
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ secrets.AWS_ACCESS_KEY_ID }}"
password: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
registry: ${{ steps.login-ecr.outputs.registry }}
image_name: ewaab-web
# change image tag to ${{ github.sha }} if you want
image_tag: latest
context: web
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: aws/ecs-fargate/ewaab-task.json
container-name: web
image: ${{ steps.docker-build.outputs.FULL_IMAGE_NAME }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ewaab-service
cluster: ewaab
# wait until service is stable
wait-for-service-stability: false