refactor:application-dev포트변경 #17
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
name: BabyWithUs CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Build with Gradle | |
env: | |
MYSQL_DATABASE_URL: ${{ secrets.MYSQL_DATABASE_URL }} | |
MYSQL_DATABASE_USERNAME: ${{ secrets.MYSQL_DATABASE_USERNAME }} | |
MYSQL_DATABASE_PASSWORD: ${{ secrets.MYSQL_DATABASE_PASSWORD }} | |
MYSQL_DATABASE_LOCAL_URL: ${{ secrets.MYSQL_DATABASE_LOCAL_URL }} | |
PROFILE: ${{ secrets.PROFILE }} # 활성화할 프로파일 | |
run: ./gradlew clean build -Dspring.profiles.active=${{ secrets.PROFILE }} | |
- name: Stop previous application | |
uses: appleboy/[email protected] | |
continue-on-error: true | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
script: "pkill -f 'BabyWithUs-0.0.1-SNAPSHOT.jar' || true" | |
- name: Copy files to server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
source: "build/libs/*.jar" | |
target: "/home/ec2-user/BabyWithUs-Back/build/libs/" |