Upgrade Dependencies #311
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: Build and Deploy | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Modify configuration files | |
run: | | |
sed -i 's#<property name="LOG_PATH" value=".*" />#<property name="LOG_PATH" value="${{ secrets.LOG_PATH }}" />#' tang-admin/src/main/resources/logback.xml | |
sed -i '0,/password: .*/s/password: .*/password: ${{ secrets.DATABASE_PASSWORD }}/' tang-admin/src/main/resources/application-prod.yml | |
sed -i '0,/password/! {s/password: .*/password: ${{ secrets.REDIS_PASSWORD }}/}' tang-admin/src/main/resources/application-prod.yml | |
sed -i '/github:/,/client-secret:/ s/\(client-secret: \).*/\1${{ secrets.CLIENT_SECRET_GITHUB }}/' tang-admin/src/main/resources/application-prod.yml | |
- name: Build with Maven | |
run: sh bin/package.sh | |
# - name: Move JAR file | |
# uses: appleboy/ssh-action@master | |
# with: | |
# host: ${{ secrets.SERVER_HOST }} | |
# username: ${{ secrets.SERVER_USERNAME }} | |
# password: ${{ secrets.SERVER_PASSWORD }} | |
# script: | | |
# cd /root | |
# if [ -d 'tang-boot' ]; then | |
# mkdir tang-boot | |
# fi | |
# cd tang-boot/ | |
# if [ ! -d 'jars' ]; then | |
# mkdir jars | |
# fi | |
# for file in $(ls tang-admin-*.jar); do | |
# mv $file jars/$file-$(date +%Y%m%d%H%M%S).jar | |
# done | |
# | |
# - name: Deploy to server | |
# uses: appleboy/scp-action@master | |
# with: | |
# host: ${{ secrets.SERVER_HOST }} | |
# username: ${{ secrets.SERVER_USERNAME }} | |
# password: ${{ secrets.SERVER_PASSWORD }} | |
# port: 22 | |
# source: 'tang-admin/target/tang-admin-*.jar' | |
# target: /root/tang-boot/ | |
# | |
# - name: Run JAR file | |
# uses: appleboy/ssh-action@master | |
# with: | |
# host: ${{ secrets.SERVER_HOST }} | |
# username: ${{ secrets.SERVER_USERNAME }} | |
# password: ${{ secrets.SERVER_PASSWORD }} | |
# script: | | |
# cd /root/tang-boot/ | |
# mv tang-admin/target/tang-admin-*.jar ./ | |
# rm -rf tang-admin/ | |
# kill -9 $(ps -ef | grep tang-admin-* | grep -v grep | awk '{print $2}') | |
# nohup java -Dlogging.config=classpath:logback.xml -jar tang-admin-*.jar > /dev/null 2>&1 & |