-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (116 loc) · 5.58 KB
/
Copy pathrelease.yml
File metadata and controls
131 lines (116 loc) · 5.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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Release
# Monorepo, so a bare "v1.2.3" tag would be ambiguous. Two tag shapes are supported:
#
# containerutil-v0.1.0 release ONE project, built at the version in the tag
# claimviz-v0.2.0 (the tag version overrides gradle.properties, so tagging is
# trarncore-v0.1.0 the single action that cuts a release)
#
# all-v0.3.0 release EVERY mod in one go, each built at its own configured
# version. The version in the tag is only the release label — it is
# deliberately not forced onto the mods. They were levelled to 0.2.0
# at the 26.1.2 port purely as a baseline, and are expected to drift
# apart again as individual mods change.
on:
push:
tags:
- '*-v*'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Resolve target(s) from tag
id: tag
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME}"
TARGET="${TAG%%-v*}"
VERSION="${TAG#*-v}"
if [ "$TARGET" = "all" ]; then
# Every mod, each at its own version. TrarnCore is excluded: it is bundled inside
# each mod and is never installed on its own, so it has no artifact worth releasing.
echo "dirs=ClaimViz SimDistance EasyPortalLinker ContainerUtil RSwitch TrustUI AutoRelog" >> "$GITHUB_OUTPUT"
echo "prop=" >> "$GITHUB_OUTPUT"
echo "title=Mod bundle $VERSION" >> "$GITHUB_OUTPUT"
else
case "$TARGET" in
claimviz) DIR=ClaimViz ; PROP=mod_version ;;
simdistance) DIR=SimDistance ; PROP=mod_version ;;
easyportallinker) DIR=EasyPortalLinker ; PROP=mod_version ;;
containerutil) DIR=ContainerUtil ; PROP=mod_version ;;
rswitch) DIR=RSwitch ; PROP=mod_version ;;
trustui) DIR=TrustUI ; PROP=mod_version ;;
autorelog) DIR=AutoRelog ; PROP=mod_version ;;
# The library deliberately uses its own property name, so that a mod release
# passing -Pmod_version cannot re-version the library through the composite build.
trarncore) DIR=TrarnCore ; PROP=lib_version ;;
*)
echo "::error::Unknown target '$TARGET' in tag '$TAG'. Expected <project>-v<version> (e.g. containerutil-v0.1.0) or all-v<version>."
exit 1
;;
esac
echo "dirs=$DIR" >> "$GITHUB_OUTPUT"
echo "prop=$PROP=$VERSION" >> "$GITHUB_OUTPUT"
echo "title=$DIR $VERSION" >> "$GITHUB_OUTPUT"
fi
# Every release states its Minecraft target up front. These jars are useless on the
# wrong version and the jar filenames carry only the mod version, so leaving it to
# the generated commit list is how someone ends up installing a 26.x jar on 1.21.
MC=$(grep '^minecraft_version=' versions.properties | cut -d= -f2)
echo "mc=$MC" >> "$GITHUB_OUTPUT"
- name: Set up Java 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
- name: Cache Gradle and Loom
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-release-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'versions.properties') }}
restore-keys: |
${{ runner.os }}-gradle-release-
${{ runner.os }}-gradle-
# See the note in ci.yml: Loom reads the library jar at configuration time, so it has to
# exist on disk before a mod build is even configured. Harmless when releasing TrarnCore
# itself — it just builds it once here and again below.
- name: Build TrarnCore first
working-directory: TrarnCore
run: ./gradlew build --stacktrace
- name: Build
run: |
set -euo pipefail
PROP_ARG=""
if [ -n "${{ steps.tag.outputs.prop }}" ]; then
PROP_ARG="-P${{ steps.tag.outputs.prop }}"
fi
for dir in ${{ steps.tag.outputs.dirs }}; do
echo "::group::Building $dir"
(cd "$dir" && ./gradlew build --stacktrace $PROP_ARG)
echo "::endgroup::"
done
- name: Collect jars
run: |
set -euo pipefail
mkdir -p release-jars
for dir in ${{ steps.tag.outputs.dirs }}; do
# *[^s].jar excludes the -sources.jar sitting next to it.
cp "$dir"/build/libs/*[^s].jar release-jars/
done
ls -la release-jars/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.tag.outputs.title }}
files: release-jars/*.jar
generate_release_notes: true
body: |
**Minecraft ${{ steps.tag.outputs.mc }}** · Fabric · requires **Java 25**
Install the jars from this release *together* — they share a bundled copy of
TrarnCore, and mixing them with jars from an older release is the one combination
that fails at startup with `NoClassDefFoundError`. Delete the previous jars first
rather than adding these alongside them.