Deploy directly without artifacts
Some checks failed
build-and-deploy / build-deploy (push) Has been cancelled
Some checks failed
build-and-deploy / build-deploy (push) Has been cancelled
This commit is contained in:
@@ -3,46 +3,36 @@ name: build-and-deploy
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "master" ]
|
branches: [ "master" ]
|
||||||
pull_request:
|
|
||||||
branches: [ "master" ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up JDK 19
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: "19"
|
java-version: "17"
|
||||||
cache: gradle
|
cache: gradle
|
||||||
|
|
||||||
- name: Build
|
- name: Force toolchain JDK 17
|
||||||
run: ./gradlew build -x test --no-daemon --info --stacktrace
|
run: |
|
||||||
|
if [ -f build.gradle.kts ]; then
|
||||||
|
sed -i 's/JavaLanguageVersion.of(19)/JavaLanguageVersion.of(17)/' build.gradle.kts
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Build (skip tests)
|
||||||
uses: actions/upload-artifact@v4
|
env:
|
||||||
with:
|
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000"
|
||||||
name: trisolarisserver-jar
|
run: ./gradlew build -x test --no-daemon
|
||||||
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
|
- name: Deploy jar and restart
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
sudo mkdir -p /opt/deploy/TrisolarisServer/build/libs
|
sudo mkdir -p /opt/deploy/TrisolarisServer/build/libs
|
||||||
sudo cp -f /tmp/trisolarisserver-artifact/*.jar /opt/deploy/TrisolarisServer/build/libs/
|
sudo cp -f build/libs/*.jar /opt/deploy/TrisolarisServer/build/libs/
|
||||||
sudo systemctl restart TrisolarisServer.service
|
sudo systemctl restart TrisolarisServer.service
|
||||||
|
|||||||
Reference in New Issue
Block a user