Skip to content

Commit cc2a828

Browse files
ci: avoid conflict on artifact names
1 parent a48fb20 commit cc2a828

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

.github/workflows/build-all.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ jobs:
2020
# 1.12.2 Forge builds
2121
- version: "1.12.2"
2222
os: macos-15-intel
23-
platform: macos
2423
# temurin does not provide JDK 8 series via their API: perhaps it's their bug?
2524
java_distribution: 'corretto'
2625
java_version: '8'
2726
build_script: build_lib_for_mac.sh
2827
gradle_cmd: ./gradlew
2928
mod_type: forge
29+
3030
- version: "1.12.2"
3131
os: macos-15
32-
platform: macos
3332
# temurin does not provide JDK 8 series via their API: perhaps it's their bug?
3433
java_distribution: 'corretto'
3534
java_version: '8'
@@ -40,7 +39,6 @@ jobs:
4039
# 1.18.2 Forge builds
4140
- version: "1.18.2"
4241
os: ubuntu-22.04
43-
platform: linux
4442
java_distribution: 'temurin'
4543
java_version: '17'
4644
build_script: build_lib_for_x11.sh
@@ -50,7 +48,6 @@ jobs:
5048

5149
- version: "1.18.2"
5250
os: macos-15
53-
platform: macos
5451
java_distribution: 'temurin'
5552
java_version: '17'
5653
build_script: build_lib_for_mac.sh
@@ -60,7 +57,6 @@ jobs:
6057

6158
- version: "1.18.2"
6259
os: windows-2022
63-
platform: windows
6460
java_distribution: 'temurin'
6561
java_version: '17'
6662
build_script: build_lib_for_win.sh
@@ -71,7 +67,6 @@ jobs:
7167
# 1.18.2 Fabric builds
7268
- version: "1.18.2"
7369
os: ubuntu-22.04
74-
platform: linux
7570
java_distribution: 'temurin'
7671
java_version: '17'
7772
build_script: build_lib_for_x11.sh
@@ -81,7 +76,6 @@ jobs:
8176

8277
- version: "1.18.2"
8378
os: macos-15
84-
platform: macos
8579
java_distribution: 'temurin'
8680
java_version: '17'
8781
build_script: build_lib_for_mac.sh
@@ -91,7 +85,6 @@ jobs:
9185

9286
- version: "1.18.2"
9387
os: macos-15-intel
94-
platform: macos
9588
java_distribution: 'temurin'
9689
java_version: '17'
9790
build_script: build_lib_for_mac.sh
@@ -101,7 +94,6 @@ jobs:
10194

10295
- version: "1.18.2"
10396
os: windows-2022
104-
platform: windows
10597
java_distribution: 'temurin'
10698
java_version: '17'
10799
build_script: build_lib_for_win.sh
@@ -114,22 +106,26 @@ jobs:
114106

115107
steps:
116108
- uses: actions/checkout@v4
117-
118109
- name: Set up JDK ${{ matrix.java_version }}
119110
uses: actions/[email protected]
120111
with:
121112
distribution: ${{ matrix.java_distribution }}
122113
java-version: ${{ matrix.java_version }}
123114
cache: 'gradle'
124-
115+
- name: Detect runner's OS
116+
id: os
117+
run: |
118+
echo "os=${{ toLower(runner.os) }}" >> $GITHUB_OUTPUT
119+
shell: bash
120+
125121
- name: Install build dependencies (Linux)
126-
if: matrix.platform == 'linux'
122+
if: steps.os.output.os == 'linux'
127123
run: |
128124
sudo apt-get update
129125
sudo apt-get install -y ${{ matrix.native_deps }}
130126
131127
- name: Set up MinGW (Windows)
132-
if: matrix.platform == 'windows'
128+
if: steps.os.output.os == 'windows'
133129
uses: msys2/setup-msys2@v2
134130
with:
135131
update: true
@@ -140,12 +136,12 @@ jobs:
140136
git
141137
142138
- name: Build native library (Windows)
143-
if: matrix.platform == 'windows'
139+
if: steps.os.output.os == 'windows'
144140
shell: msys2 {0}
145141
run: ./${{ matrix.build_script }}
146142

147143
- name: Build native library (Linux/macOS)
148-
if: matrix.platform != 'windows'
144+
if: steps.os.output.os != 'windows'
149145
shell: bash
150146
run: ./${{ matrix.build_script }}
151147

@@ -165,16 +161,24 @@ jobs:
165161
166162
# TODO(kisaragi): cache build artifacts
167163

164+
- name: Determine Runner's CPU
165+
id: detect-arch
166+
run: |
167+
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant()
168+
echo "architecture=$arch" >> $env:GITHUB_OUTPUT
169+
echo "Detected arch: $arch"
170+
shell: pwsh
171+
168172
- name: Upload 1.12.2 artifacts
169173
if: matrix.version == '1.12.2'
170174
uses: actions/upload-artifact@v4
171175
with:
172-
name: ${{ matrix.version }}-${{ matrix.mod_type }}-${{ matrix.platform }}
176+
name: ${{ matrix.version }}-${{ matrix.mod_type }}-${{ toLower(runner.os) }}-${{ steps.detect-arch.outputs.architecture }}
173177
path: ${{ matrix.version }}/build/libs/*.jar
174178

175179
- name: Upload 1.18.2 artifacts
176180
if: matrix.version == '1.18.2'
177181
uses: actions/upload-artifact@v4
178182
with:
179-
name: ${{ matrix.version }}-${{ matrix.mod_type }}-${{ matrix.platform }}
183+
name: ${{ matrix.version }}-${{ matrix.mod_type }}-${{ toLower(runner.os) }}-${{ steps.detect-arch.outputs.architecture }}
180184
path: ${{ matrix.version }}/${{ matrix.mod_type }}/build/libs/*.jar

0 commit comments

Comments
 (0)