-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (93 loc) · 3.44 KB
/
Copy pathjava-release.yml
File metadata and controls
107 lines (93 loc) · 3.44 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Java packages release
on:
push:
tags:
- 'mc/v*.*.*'
permissions:
contents: write
concurrency:
group: java-release-${{ github.ref }}
cancel-in-progress: false
jobs:
build-and-release:
name: Build and publish Java packages
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out tagged sources
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Read release version
id: release
shell: bash
run: |
version="${GITHUB_REF_NAME#mc/v}"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag must have the form mc/vX.Y.Z, got: $GITHUB_REF_NAME" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Set up Java 25
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '25'
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: sdk/go.mod
cache-dependency-path: |
sdk/go.sum
examples/hello-native/go.sum
- name: Set up Gradle 9.5.1
uses: gradle/actions/setup-gradle@v6
with:
gradle-version: '9.5.1'
- name: Build native ABI fixture
run: ./examples/hello-native/build.sh
- name: Build and test every Java target
env:
GMB_TEST_LIBRARY: ${{ github.workspace }}/examples/hello-native/dist/libhello_native.so
run: gradle clean build -Pmod_version="${{ steps.release.outputs.version }}" --console=plain
- name: Collect release JARs
shell: bash
run: |
version="${{ steps.release.outputs.version }}"
mkdir -p release
cp "versions/1.21.1/build/libs/gbm-1.21.1-${version}.jar" release/
cp "versions/1.21.1/build/libs/gbm-1.21.1-${version}-sources.jar" release/
cp "versions/26.1.2/build/libs/gbm-26.1.2-${version}.jar" release/
cp "versions/26.1.2/build/libs/gbm-26.1.2-${version}-sources.jar" release/
cp "platforms/paper/build/libs/gbm-paper-${version}.jar" release/
cp "platforms/paper/build/libs/gbm-paper-${version}-sources.jar" release/
find release -maxdepth 1 -type f -name '*.jar' -print -exec sha256sum {} \;
- name: Create or update GitHub Release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
shell: bash
run: |
if gh release view "$TAG" >/dev/null 2>&1; then
gh release upload "$TAG" release/*.jar --clobber
else
gh release create "$TAG" release/*.jar \
--verify-tag \
--generate-notes \
--title "Go Minecraft Bridge $TAG"
fi
- name: Publish to Modrinth
env:
GH_TOKEN: ${{ github.token }}
MODRINTH_PROJECT_ID: ${{ vars.MODRINTH_PROJECT_ID }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
shell: bash
run: |
if [[ -z "$MODRINTH_PROJECT_ID" || -z "$MODRINTH_TOKEN" ]]; then
echo "Skipping Modrinth publish: configure MODRINTH_PROJECT_ID and MODRINTH_TOKEN." >&2
exit 0
fi
changelog="$(gh release view "$GITHUB_REF_NAME" --json body --jq .body)"
MODRINTH_CHANGELOG="$changelog" ./gradlew publishModrinth \
-Pmod_version="${{ steps.release.outputs.version }}" \
--console=plain