forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (69 loc) · 2.73 KB
/
deploy.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
86
name: Deploy
on:
push:
branches:
- deploy/v1
jobs:
build:
runs-on: ubuntu-latest
env:
working-directory: ./backend/moment/moment-server
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: 17 # 원하는 Java 버전으로 변경
distribution: 'temurin'
- uses: actions/checkout@v3
- run: touch ./backend/moment/moment-server/auth/src/main/resources/application.properties
- run: echo "${{ secrets.AUTH_PROPERTIES }}" > ./backend/moment/moment-server/auth/src/main/resources/application.properties
- run: touch ./backend/moment/moment-server/core/src/main/resources/application.properties
- run: echo "${{ secrets.CORE_PROPERTIES }}" > ./backend/moment/moment-server/core/src/main/resources/application.properties
- run: touch ./backend/moment/moment-server/mail/src/main/resources/application.properties
- run: echo "${{ secrets.MAIL_PROPERTIES }}" > ./backend/moment/moment-server/mail/src/main/resources/application.properties
- run: touch ./backend/moment/moment-server/scheduler/src/main/resources/application.properties
- run: echo "${{ secrets.SCHEDULER_PROPERTIES }}" > ./backend/moment/moment-server/scheduler/src/main/resources/application.properties
# - run: cat ./src/main/resources/application.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
#
# - name: Build with Gradle
# uses: gradle/gradle-build-action@v2
# with:
# arguments: build -x test
# build-root-directory: ./backend/moment/moment-server
# gradle-version: 7.5
#
# - name: Deploy to Server
# uses: actions/checkout@v3
# - run: |
# docker-compose up --build
# working-directory: ${{ env.working-directory }}
# 서버에 애플리케이션 배포 스크립트 실행
# 예: scp, SSH, Docker, Kubernetes 등을 사용하여 배포
deploy:
env:
working-directory: ./backend/moment/moment-server
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v3
- name: Add Server key
run: |
touch key.txt
echo "${{ secrets.SERVER_KEY }}" > key.txt
chmod 600 key.txt
working-directory: ${{ env.working-directory }}
- name: Deploy the application
env:
SERVER_HOST: ${{ secrets.SERVER_HOST }}
SERVER_PORT: ${{ secrets.SERVER_PORT }}
SERVER_USER: ${{ secrets.SERVER_USER }}
run: |
chmod 755 ./deploy.sh
set -e
./deploy.sh
working-directory: ${{ env.working-directory }}