Skip to content

Commit 45e6a98

Browse files
Refactor GitHub Actions workflow for Gradle build
1 parent 2e71642 commit 45e6a98

1 file changed

Lines changed: 18 additions & 68 deletions

File tree

.github/workflows/build.yml

Lines changed: 18 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,28 @@
1-
name: Gradle CI (new)
1+
name: Build Mod Without Local JDK
22

3-
on:
4-
push:
5-
paths-ignore:
6-
- 'README.md'
7-
- 'LICENSE'
8-
- '.gitignore'
9-
- '.editorconfig'
10-
- 'changelog.md'
11-
- 'docs'
12-
pull_request:
3+
on: [push, workflow_dispatch]
134

145
jobs:
15-
generate-build-matrix:
16-
runs-on: ubuntu-latest
17-
name: Generate build matrix
18-
19-
outputs:
20-
matrix: ${{ steps.generate-matrix.outputs.matrix }}
21-
22-
steps:
23-
- uses: actions/checkout@v4
24-
with:
25-
fetch-depth: 0
26-
- name: Get potential versions
27-
id: generate-matrix
28-
run: |
29-
MATRIX=$(jq -c '{include: (.branches[""] | map({target: ., experimental: (test("exp"))}))}' ./versions/versions.json)
30-
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
31-
326
build:
33-
needs: generate-build-matrix
347
runs-on: ubuntu-latest
35-
name: Build with gradle
36-
37-
strategy:
38-
fail-fast: false
39-
matrix: ${{ fromJson(needs.generate-build-matrix.outputs.matrix) }}
40-
41-
continue-on-error: ${{ matrix.experimental == 'true' }}
42-
438
steps:
44-
- uses: actions/checkout@v4
45-
- name: Set up JDK
9+
- name: Checkout Repository
10+
uses: actions/checkout@v4
11+
12+
- name: Set up Java
4613
uses: actions/setup-java@v4
4714
with:
48-
java-version: 25
49-
distribution: temurin
50-
- name: Make gradlew executable
51-
run: chmod +x ./gradlew
52-
- name: Overwrite current version
53-
run: printf "%s" "${{ matrix.target }}" | cut -d':' -f1 | tr -d '\n' > ./versions/current
54-
- name: Build ${{ matrix.target }}
55-
run: |
56-
./gradlew "Refresh active project"
57-
./gradlew buildAndCollectActive --stacktrace
58-
env:
59-
CI_SINGLE_BUILD: ${{ matrix.target }}
15+
distribution: 'temurin'
16+
java-version: '25' # Change to 17 or 8 depending on the Minecraft version
6017

61-
- name: Sanitize artifact name
62-
run: |
63-
raw="${{ matrix.target }}"
64-
clean="${raw%%:*}"
65-
echo "ARTIFACT_NAME=$clean" >> $GITHUB_ENV
66-
- uses: actions/upload-artifact@v4
67-
with:
68-
path: build/finalJars/*.jar
69-
name: ${{ env.ARTIFACT_NAME }}
18+
- name: Make Gradle Executable
19+
run: chmod +x gradlew
20+
21+
- name: Build with Gradle
22+
run: ./gradlew build
7023

71-
# run:
72-
# needs: build
73-
# runs-on: ubuntu-latest
74-
# name: Run Minecraft
75-
#
76-
# strategy:
77-
# matrix:
78-
# target: ${{ fromJson(needs.retrieve-targets.outputs.targets) }}
24+
- name: Upload Mod Jar
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: compiled-mod
28+
path: build/libs/*.jar

0 commit comments

Comments
 (0)