Merge pull request #236 from SWM14-HumanError/develop #26
This file contains hidden or 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: Deploy To SideMatch | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Github Repository ํ์ผ ๋ถ๋ฌ์ค๊ธฐ | |
| uses: actions/checkout@v4 | |
| - name: JDK 17๋ฒ์ ์ค์น | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: yml ํ์ผ๋ค ๋ง๋ค๊ธฐ | |
| run: | | |
| echo "${{ secrets.APPLICATION_YML }}" > ./src/main/resources/application.yml | |
| echo "${{ secrets.APPLICATION_DB_YML }}" > ./src/main/resources/application-db.yml | |
| echo "${{ secrets.APPLICATION_OAUTH_YML }}" > ./src/main/resources/application-oauth.yml | |
| - name: ํ ์คํธ ๋ฐ ๋น๋ํ๊ธฐ | |
| run: ./gradlew clean build -x test | |
| - name: ๋น๋๋ ํ์ผ ์ด๋ฆ ๋ณ๊ฒฝํ๊ธฐ | |
| run: mv ./build/libs/*SNAPSHOT.jar ./sidematch.jar | |
| - name: SCP๋ก EC2์ ๋น๋๋ ํ์ผ ์ ์กํ๊ธฐ | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USERNAME }} | |
| key: ${{ secrets.EC2_PRIVATE_KEY }} | |
| port: 22 | |
| source: sidematch.jar | |
| target: /home/ubuntu/Match-Up-Backend/tobe | |
| - name: SSH๋ก EC2์ ์ ์ํ๊ธฐ | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USERNAME }} | |
| key: ${{ secrets.EC2_PRIVATE_KEY }} | |
| port: 22 | |
| script_stop: true | |
| script: | | |
| rm -rf /home/ubuntu/Match-Up-Backend/current | |
| mkdir /home/ubuntu/Match-Up-Backend/current | |
| mv /home/ubuntu/Match-Up-Backend/tobe/sidematch.jar /home/ubuntu/Match-Up-Backend/current/sidematch.jar | |
| cd /home/ubuntu/Match-Up-Backend/current | |
| sudo fuser -k -n tcp 8080 || true | |
| nohup java -jar sidematch.jar > ./output.log 2>&1 & | |
| rm -rf /home/ubuntu/Match-Up-Backend/tobe |