improve deployment
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
name: build
|
name: build-and-deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "**" ]
|
branches: [ "master" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "**" ]
|
branches: [ "master" ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -23,16 +24,25 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew build -x test --no-daemon --info --stacktrace
|
run: ./gradlew build -x test --no-daemon --info --stacktrace
|
||||||
|
|
||||||
- name: Upload jar
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: trisolarisserver-jar
|
name: trisolarisserver-jar
|
||||||
path: build/libs/*.jar
|
path: build/libs/TrisolarisServer-*-SNAPSHOT.jar
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
- name: Trigger deploy webhook
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: trisolarisserver-jar
|
||||||
|
path: /tmp/trisolarisserver-artifact
|
||||||
|
|
||||||
|
- name: Deploy jar and restart
|
||||||
run: |
|
run: |
|
||||||
curl -sS -X POST -H "X-Gitea-Event: push" http://127.0.0.1:9000/hooks/deploy-trisolarisserver
|
set -e
|
||||||
|
sudo mkdir -p /opt/deploy/TrisolarisServer/build/libs
|
||||||
|
sudo cp -f /tmp/trisolarisserver-artifact/*.jar /opt/deploy/TrisolarisServer/build/libs/
|
||||||
|
sudo systemctl restart TrisolarisServer.service
|
||||||
Reference in New Issue
Block a user