Update cicd.yml #21
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: Deploy | |
on: | |
push: | |
branches: [main,cicd] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build & Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.PRIVATE_KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
cd ~/back-end | |
pkill -f 'java -jar haru4cut-0.0.1-SNAPSHOT.jar' # 프로세스 죽이기 | |
git pull origin main | |
/home/ubuntu/back-end/gradlew clean build -x test | |
cd /home/ubuntu/back-end/build/libs | |
nohup java -jar haru4cut-0.0.1-SNAPSHOT.jar & |