|
1 | | -name: Gradle CI (new) |
| 1 | +name: Build Mod Without Local JDK |
2 | 2 |
|
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] |
13 | 4 |
|
14 | 5 | 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 | | -
|
32 | 6 | build: |
33 | | - needs: generate-build-matrix |
34 | 7 | 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 | | - |
43 | 8 | 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 |
46 | 13 | uses: actions/setup-java@v4 |
47 | 14 | 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 |
60 | 17 |
|
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 |
70 | 23 |
|
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