forked from marggx/ModelCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (61 loc) · 2.58 KB
/
release.yml
File metadata and controls
75 lines (61 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Release
on:
release:
types: [published]
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
- name: Fetch latest Hytale Server version
id: hytale-version
run: |
LATEST_VERSION=$(curl -s https://maven.hytale.com/release/com/hypixel/hytale/Server/maven-metadata.xml \
| grep -o '<latest>[^<]*</latest>' | sed 's/<[^>]*>//g')
echo "version=${LATEST_VERSION}" >> $GITHUB_OUTPUT
echo "Fetched Hytale Server version: $LATEST_VERSION"
- name: Update versions in gradle.properties
run: |
VERSION="${GITHUB_REF_NAME}"
SERVER_VERSION="${{ steps.hytale-version.outputs.version }}"
sed -i "s/^version=.*/version=${VERSION}/" gradle.properties
sed -i "s/^server_version=.*/server_version=${SERVER_VERSION}/" gradle.properties
echo "Building version: ${VERSION}, Server version: ${SERVER_VERSION}"
- name: Cache Hytale Server JAR
id: cache-hytale
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/hytale-home
key: hytale-server-${{ steps.hytale-version.outputs.version }}
- name: Download Hytale Server JAR
if: steps.cache-hytale.outputs.cache-hit != 'true'
run: |
LATEST_VERSION="${{ steps.hytale-version.outputs.version }}"
JAR_DIR="${{ runner.temp }}/hytale-home/"
mkdir -p "$JAR_DIR"
echo "Downloading Hytale Server version: $LATEST_VERSION"
curl -L "https://maven.hytale.com/release/com/hypixel/hytale/Server/${LATEST_VERSION}/Server-${LATEST_VERSION}.jar" \
-o "$JAR_DIR/HytaleServer.jar"
- name: Make gradlew executable
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -Pjar_dir="${{ runner.temp }}/hytale-home"
- name: Commit and push updated files
run: |
git config user.name "[bot]release"
git config user.email "release+github-actions[bot]@users.noreply.github.com"
git add gradle.properties src/main/resources/manifest.json
git commit -m "build(release): bump version to ${GITHUB_REF_NAME}"
git push origin HEAD:${{ github.event.repository.default_branch }}
- name: Upload artifacts to release
uses: softprops/action-gh-release@v2
with:
files: build/libs/*.jar