Skip to content

Commit 83a018a

Browse files
committed
Don't upload multiple times to same artifact in release workflow
The release workflow produces binaries for a range of target hosts. This is done by using a job matrix in the GitHub Actions workflow that produces each build in a parallel job. GitHub Actions workflow artifacts are used to transfer the generated files between sequential jobs in the workflow. The "actions/upload-artifact" action is used for this purpose. Previously, a single artifact was used for this purpose, with each of the parallel jobs uploading its own generated files to that artifact. However, support for uploading multiple times to a single artifact was dropped in version 4.0.0 of the "actions/upload-artifact" action. So it is now necessary to use a dedicated artifact for each of the builds. These can be downloaded in aggregate by using the artifact name globbing and merging features which were introduced in version 4.1.0 of the "actions/download-artifact" action.
1 parent 4a1f102 commit 83a018a

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

.github/workflows/release-go-task.yml

+33-20
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
DIST_DIR: dist
99
# The project's folder on Arduino's download server for uploading builds
1010
AWS_PLUGIN_TARGET: /arduino-language-server/
11-
ARTIFACT_NAME: dist
11+
ARTIFACT_PREFIX: dist-
1212

1313
on:
1414
push:
@@ -21,16 +21,25 @@ jobs:
2121

2222
strategy:
2323
matrix:
24-
task:
25-
- Windows_32bit
26-
- Windows_64bit
27-
- Linux_32bit
28-
- Linux_64bit
29-
- Linux_ARMv6
30-
- Linux_ARMv7
31-
- Linux_ARM64
32-
- macOS_64bit
33-
- macOS_ARM64
24+
os:
25+
- task: Windows_32bit
26+
artifact-suffix: Windows_32bit
27+
- task: Windows_64bit
28+
artifact-suffix: Windows_64bit
29+
- task: Linux_32bit
30+
artifact-suffix: Linux_32bit
31+
- task: Linux_64bit
32+
artifact-suffix: Linux_64bit
33+
- task: Linux_ARMv6
34+
artifact-suffix: Linux_ARMv6
35+
- task: Linux_ARMv7
36+
artifact-suffix: Linux_ARMv7
37+
- task: Linux_ARM64
38+
artifact-suffix: Linux_ARM64
39+
- task: macOS_64bit
40+
artifact-suffix: macOS_64bit
41+
- task: macOS_ARM64
42+
artifact-suffix: macOS_ARM64
3443

3544
steps:
3645
- name: Checkout repository
@@ -40,7 +49,7 @@ jobs:
4049

4150
- name: Create changelog
4251
# Avoid creating the same changelog for each os
43-
if: matrix.task == 'Windows_32bit'
52+
if: matrix.os.task == 'Windows_32bit'
4453
uses: arduino/create-changelog@v1
4554
with:
4655
tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+.*$'
@@ -55,13 +64,13 @@ jobs:
5564
version: 3.x
5665

5766
- name: Build
58-
run: task dist:${{ matrix.task }}
67+
run: task dist:${{ matrix.os.task }}
5968

6069
- name: Upload artifacts
6170
uses: actions/upload-artifact@v4
6271
with:
6372
if-no-files-found: error
64-
name: ${{ env.ARTIFACT_NAME }}
73+
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.os.artifact-suffix }}
6574
path: ${{ env.DIST_DIR }}
6675

6776
notarize-macos:
@@ -78,9 +87,11 @@ jobs:
7887
strategy:
7988
matrix:
8089
build:
81-
- folder-suffix: darwin_amd64
90+
- artifact-suffix: macOS_64bit
91+
folder-suffix: darwin_amd64
8292
package-suffix: "macOS_64bit.tar.gz"
83-
- folder-suffix: darwin_arm64
93+
- artifact-suffix: macOS_ARM64
94+
folder-suffix: darwin_arm64
8495
package-suffix: "macOS_ARM64.tar.gz"
8596

8697
steps:
@@ -97,7 +108,7 @@ jobs:
97108
- name: Download artifacts
98109
uses: actions/download-artifact@v4
99110
with:
100-
name: ${{ env.ARTIFACT_NAME }}
111+
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
101112
path: ${{ env.DIST_DIR }}
102113

103114
- name: Import Code-Signing Certificates
@@ -168,11 +179,12 @@ jobs:
168179
-C "${{ env.BUILD_FOLDER }}/" "${{ env.PROJECT_NAME }}" \
169180
-C ../../ LICENSE.txt
170181
171-
- name: Upload artifact
182+
- name: Replace artifact with notarized build
172183
uses: actions/upload-artifact@v4
173184
with:
174185
if-no-files-found: error
175-
name: ${{ env.ARTIFACT_NAME }}
186+
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
187+
overwrite: true
176188
path: ${{ env.DIST_DIR }}/${{ env.PACKAGE_FILENAME }}
177189

178190
create-release:
@@ -183,7 +195,8 @@ jobs:
183195
- name: Download artifact
184196
uses: actions/download-artifact@v4
185197
with:
186-
name: ${{ env.ARTIFACT_NAME }}
198+
pattern: ${{ env.ARTIFACT_PREFIX }}*
199+
merge-multiple: true
187200
path: ${{ env.DIST_DIR }}
188201

189202
- name: Create checksum file

0 commit comments

Comments
 (0)