Skip to content

Commit dfd540c

Browse files
Add CI build workflow
Builds on push to 26.2-architectury and uploads the jar to the run, so builds can be downloaded without a local toolchain. Jars are renamed <Mod>-<mcVersion>-<version>+<sha> so a download is traceable to the commit; the build's own version is untouched, since changing it would change the maven coordinates the rest of the stack resolves by. Publishes nothing -- artifacts live on the workflow run only. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NddmKFHX4r9dRsTdYysFcz
1 parent 1916e2d commit dfd540c

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Builds the mod and uploads the jar so it can be downloaded from the Actions run.
2+
#
3+
# Jars are renamed to <Mod>-<mcVersion>-<version>+<short sha> so a download is traceable to
4+
# the exact commit. The build's own version is left alone -- changing it would change the
5+
# maven coordinates the rest of the stack resolves by.
6+
#
7+
# Nothing here publishes anywhere. Artifacts live on the workflow run only.
8+
name: Build
9+
10+
on:
11+
push:
12+
branches: [ "26.2-architectury" ]
13+
pull_request:
14+
branches: [ "26.2-architectury" ]
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 60
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up JDK 25
29+
uses: actions/setup-java@v4
30+
with:
31+
java-version: '25'
32+
distribution: 'temurin'
33+
34+
- name: Set up Gradle
35+
uses: gradle/actions/setup-gradle@v4
36+
37+
- name: Build
38+
run: |
39+
chmod +x gradlew
40+
./gradlew build --no-daemon
41+
42+
- name: Stage jars with commit hash
43+
id: stage
44+
run: |
45+
short="${GITHUB_SHA::7}"
46+
mkdir -p ci-artifacts
47+
# `-raw` is the shadow plugin's pre-merge jar and `-sources` is not a runnable mod;
48+
# shipping either would just invite someone to install the wrong one.
49+
for jar in neoforge/build/libs/*.jar; do
50+
[ -e "$jar" ] || continue
51+
case "$jar" in *-raw.jar|*-sources.jar) continue ;; esac
52+
base=$(basename "$jar" .jar)
53+
cp "$jar" "ci-artifacts/${base}+${short}.jar"
54+
done
55+
ls -l ci-artifacts
56+
primary=$(find ci-artifacts -name '*.jar' | sort | head -1)
57+
test -n "$primary" || { echo "::error::no jars were produced"; exit 1; }
58+
echo "name=$(basename "$primary" .jar)" >> "$GITHUB_OUTPUT"
59+
60+
- name: Upload jars
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: ${{ steps.stage.outputs.name }}
64+
path: ci-artifacts/*.jar
65+
if-no-files-found: error

0 commit comments

Comments
 (0)