fix: test #41
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: cd-dev | |
on: | |
push: | |
branches: [ "dev" ] | |
jobs: | |
deploy-to-ec2: | |
environment: dev | |
runs-on: ubuntu-latest | |
steps: | |
- name: Github Repository Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
- name: Sending build file to NAS | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.NAS_HOST }} | |
port: ${{ secrets.NAS_PORT }} | |
username: ${{ secrets.NAS_USERNAME }} | |
password: ${{ secrets.NAS_PASSWORD }} | |
source: "build/libs/*.jar" | |
target: "/root/omg/" | |
- name: Deploy to EC2 and Restart Service | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.NAS_HOST }} | |
port: ${{ secrets.NAS_PORT }} | |
username: ${{ secrets.NAS_USERNAME }} | |
password: ${{ secrets.NAS_PASSWORD }} | |
script: | | |
pkill -f 'java.*omg-0.0.1-SNAPSHOT.jar' | |
cd ~/omg/build/libs | |
chmod 755 omg-0.0.1-SNAPSHOT.jar | |
nohup java -Dspring.profiles.active=dev -jar omg-0.0.1-SNAPSHOT.jar > omg-server.log 2>&1 & |