-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.32 KB
/
back-api-cd.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
name: backEnd API server CD
on:
push:
branches: [BE/release, main]
permissions:
contents: read
jobs:
api-server-cd:
runs-on: ubuntu-latest
steps:
- name: ✅ 코드 체크아웃
uses: actions/checkout@v3
- name: 👻 노드 설정
uses: actions/setup-node@v3
with:
node-version: "20"
- name: ⬇️ 의존성 설치
working-directory: ./backEnd/api
run: npm ci
- name: 📦 프로젝트 빌드
working-directory: ./backEnd/api
run: npm run build
- name: 🐳 도커 로그인
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_TOKEN}}
- name: ⬆️ Docker Image Build
working-directory: ./backEnd/api
run: |
docker build -t ${{secrets.DOCKER_USERNAME}}/api .
docker push ${{secrets.DOCKER_USERNAME}}/api
- name: 🏃♂️ Deploy
uses: appleboy/[email protected]
with:
host: ${{secrets.API_HOST}}
username: ${{secrets.API_USERNAME}}
password: ${{secrets.API_PASSWORD}}
port: ${{secrets.API_PORT}}
script: |
cd /root
echo "${{secrets.API_ENV}}" > .env
bash deploy.sh >> /dev/deploy.log 2>&1