基础代码整理 #80
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: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "liberica" | |
java-version: "21" | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Check Java and Gradle | |
run: | | |
java -version | |
gradle -v | |
- name: Build with Gradle | |
run: | | |
./gradlew clean bootJar | |
cd ./platform-boot-server/app-server/build/libs | |
zip -qr app.zip libs-external libs-internal app.jar | |
- name: Deploy | |
uses: wlixcc/[email protected] | |
with: | |
server: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USER }} | |
ssh_private_key: ${{ secrets.SERVER_KEY }} | |
local_path: "platform-boot-server/app-server/build/libs/app.zip" | |
remote_path: "/data/app/deploy" | |
sftpArgs: "-o ConnectTimeout=5" | |
- name: Executing Remote SSH Commands | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SERVER_KEY }} | |
script: | | |
sh /data/app/tools/deploy-app.sh |