forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
✨ CI/CD 설정
- Loading branch information
Showing
5 changed files
with
88 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- deploy/v1 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
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: Build with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: build | ||
|
||
- name: Deploy to Server | ||
uses: actions/checkout@v3 | ||
|
||
- run: docker-compose up --build | ||
|
||
# 서버에 애플리케이션 배포 스크립트 실행 | ||
# 예: scp, SSH, Docker, Kubernetes 등을 사용하여 배포 | ||
deploy: | ||
|
||
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 | ||
- 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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ssh -tt -p ${SERVER_PORT} ${SERVER_USER}@${SERVER_HOST} -i key.txt -o StrictHostKeyChecking=no << 'ENDSSH' | ||
cd capstone-2024-22 | ||
git pull origin "deploy/v1" | ||
docker-compose up --build -d | ||
ENDSSH |