-
Notifications
You must be signed in to change notification settings - Fork 3
85 lines (72 loc) ยท 2.32 KB
/
frontend-deploy-prod.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
80
81
82
83
84
85
name: Frontend Deploy to Prod
on:
push:
branches:
- main
paths:
- frontend/**
- .github/**
jobs:
build-dockerfile:
defaults:
run:
working-directory: frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Cache Yarn global cache
uses: actions/cache@v3
with:
path: '**/.yarn'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Yarn project cache
uses: actions/cache@v3
with:
path: '**/.yarn/cache'
key: ${{ runner.os }}-yarn-project-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-project-
- name: Install dependencies
run: yarn install --immutable
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./frontend
push: true
tags: ${{ secrets.FRONTEND_IMAGE_NAME }}:latest
platforms: |
linux/amd64
linux/arm64
deploy-to-develop-EC2:
needs: build-dockerfile
runs-on: front-prod-server
steps:
- name: Deploy to Develop EC2
run: |
docker stop ${{ secrets.FRONTEND_CONTAINER_NAME }} || true
docker rm ${{ secrets.FRONTEND_CONTAINER_NAME }} || true
docker pull ${{ secrets.FRONTEND_IMAGE_NAME }}:latest
docker run -d -p 3000:3000 --name ${{ secrets.FRONTEND_CONTAINER_NAME }} ${{ secrets.FRONTEND_IMAGE_NAME }}:latest
- name: Slack Notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: ํ๋ก ํธ์๋ ๋ฐฐํฌ ์๋ฆผ
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()