48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
name: build-and-deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [ "master" ]
|
|
pull_request:
|
|
branches: [ "master" ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 19
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: "19"
|
|
cache: gradle
|
|
|
|
- name: Build
|
|
run: ./gradlew build -x test --no-daemon --info --stacktrace
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: trisolarisserver-jar
|
|
path: build/libs/TrisolarisServer-*-SNAPSHOT.jar
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: trisolarisserver-jar
|
|
path: /tmp/trisolarisserver-artifact
|
|
|
|
- name: Deploy jar and restart
|
|
run: |
|
|
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 |