Skip to content

Commit 3608ae2

Browse files
committed
Don't upload multiple times to same artifact in build workflow
The "build" 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 83a018a commit 3608ae2

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Diff for: .github/workflows/build.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
branches:
1212
- main
1313

14+
env:
15+
ARTIFACT_PREFIX: dist-
16+
1417
jobs:
1518

1619
build:
@@ -20,13 +23,16 @@ jobs:
2023
strategy:
2124
matrix:
2225
config:
23-
- os: ubuntu-latest
26+
- artifact-suffix: Linux_64bit
27+
os: ubuntu-latest
2428
ExecutableSuffix: ''
2529
Exports: ''
26-
- os: macos-latest
30+
- artifact-suffix: macOS_ARM64
31+
os: macos-latest
2732
ExecutableSuffix: ''
2833
Exports: 'CGO_ENABLED=1 MACOSX_DEPLOYMENT_TARGET=10.14 '
29-
- os: windows-2019
34+
- artifact-suffix: Windows_64bit
35+
os: windows-2019
3036
ExecutableSuffix: '.exe'
3137
Exports: ''
3238
runs-on: ${{ matrix.config.os }}
@@ -50,7 +56,7 @@ jobs:
5056
- name: Upload Workflow Artifact [GitHub Actions]
5157
uses: actions/upload-artifact@v4
5258
with:
53-
name: build-artifacts
59+
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.config.artifact-suffix }}
5460
# this makes the artifact a .zip of the .zip archive, which is currently necessary to preserve the executable file permissions
5561
# see: https://github.com/actions/upload-artifact/issues/38
5662
path: ${{ env.BUILD_OUTPUT_DIRECTORY }}/archive/${{ env.EXECUTABLE_NAME }}_${{ runner.OS }}_amd64.zip
@@ -63,7 +69,8 @@ jobs:
6369
- name: Download Workflow Artifact [GitHub Actions]
6470
uses: actions/download-artifact@v4
6571
with:
66-
name: build-artifacts
72+
pattern: ${{ env.ARTIFACT_PREFIX }}*
73+
merge-multiple: true
6774
path: build-artifacts
6875

6976
- name: Publish Nightly [S3]

0 commit comments

Comments
 (0)