-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
389e404
commit d44be84
Showing
1 changed file
with
2 additions
and
70 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,62 +8,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Gradle Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Setup redis | ||
uses: shogo82148/[email protected] | ||
with: | ||
redis-version: 6.2.0 | ||
redis-port: 6379 | ||
auto-start: true | ||
|
||
- name: injection application.yml | ||
run: | | ||
touch src/main/resources/application-prod.yml | ||
touch src/main/resources/application-dev.yml | ||
touch src/main/resources/application-test.yml | ||
touch src/main/resources/application-prod-log.properties | ||
touch src/main/resources/application-dev-log.properties | ||
echo "${{ secrets.PROD_YML }}" > src/main/resources/application-prod.yml | ||
echo "${{ secrets.DEV_YML }}" > src/main/resources/application-dev.yml | ||
echo "${{ secrets.TEST_YML }}" > src/main/resources/application-test.yml | ||
echo "${{ secrets.DEV_LOG_PROPERTIES }}" > src/main/resources/application-dev-log.properties | ||
echo "${{ secrets.PROD_LOG_PROPERTIES }}" > src/main/resources/application-prod-log.properties | ||
shell: bash | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew clean build | ||
|
||
- name: Deliver JAR File | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST2 }} | ||
username: ${{ secrets.SSH_USERNAME2 }} | ||
password: ${{ secrets.SSH_PASSWORD2 }} | ||
port: ${{ secrets.SSH_PORT2 }} | ||
timeout: "60s" | ||
source: "build/libs/*.jar" | ||
target: "source" | ||
rm: true | ||
|
||
|
||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
|
@@ -72,17 +17,4 @@ jobs: | |
password: ${{ secrets.SSH_PASSWORD2 }} | ||
port: ${{ secrets.SSH_PORT2 }} | ||
script: | | ||
SOURCE_DIR=source/build/libs | ||
FILE_NAME=`find $SOURCE_DIR/*.jar -printf "%f\n"` | ||
PID=$(sudo lsof -Fp -i TCP:8080 | grep -Po 'p[0-9]+' | grep -Po '[0-9]+') | ||
if [ -z "$PID" ]; then | ||
echo "#### THERE IS NO PROCESS ####" | ||
else | ||
echo "#### KILL $PID ####" | ||
sudo kill -9 $PID | ||
fi | ||
echo "#### RUN $SOURCE_DIR/$FILE_NAME ####" | ||
sudo nohup java -jar -Dspring.profiles.active="prod" $SOURCE_DIR/$FILE_NAME 1>$SOURCE_DIR/stdout.out 2>$SOURCE_DIR/stderr.out 2>&1 & | ||
echo "test" > ~/tt.txt |