[setting] 환경 변수 확인 #33
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 : Sanbo-Sillok-Server | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
build: | |
runs-on : ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: permission | |
run: chmod +wrx gradlew | |
- name: Build with Gradle | |
uses: gradle/[email protected] | |
with: | |
arguments: build | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Sanbo-Sillok-Server | |
path: build/libs/sanbosillokserver-0.0.1-SNAPSHOT.jar | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: Sanbo-Sillok-Server | |
path: build/libs/ | |
- name: Deploy to EC2 | |
run: | | |
sshpass -p ${{ secrets.EC2_PASSWORD }} scp -o StrictHostKeyChecking=no build/libs/sanbosillokserver-0.0.1-SNAPSHOT.jar ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }}:/home/${{ secrets.EC2_USERNAME }}/ | |
sshpass -p ${{ secrets.EC2_PASSWORD }} ssh -T -o StrictHostKeyChecking=no ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }} "echo $DATABASE_NAME; source ~/.bashrc; pgrep java | xargs kill -9; nohup java -jar sanbosillokserver-0.0.1-SNAPSHOT.jar &" |