Skip to content

Commit 86b1fb5

Browse files
Upload build artifacts separately
Previously, the different builds were firstly uploaded using a single artifact, which was then downloaded to create different ones and eventually deleted. Now, since builds are created concurrently, the same matrix can be used to directly upload an artifact for each build. It's necessary to use a second job to calculate the checksum related to each build and save them all in a single .txt file.
1 parent 370016b commit 86b1fb5

File tree

1 file changed

+46
-59
lines changed

1 file changed

+46
-59
lines changed

Diff for: .github/workflows/publish-go-tester-task.yml

+46-59
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,41 @@ jobs:
5555
echo "::set-output name=result::$RESULT"
5656
5757
build:
58+
name: Build ${{ matrix.os.name }}
5859
needs: run-determination
5960
if: needs.run-determination.outputs.result == 'true'
6061
runs-on: ubuntu-latest
6162

6263
strategy:
6364
matrix:
6465
os:
65-
- Windows_32bit
66-
- Windows_64bit
67-
- Linux_32bit
68-
- Linux_64bit
69-
- Linux_ARMv6
70-
- Linux_ARMv7
71-
- Linux_ARM64
72-
- macOS_64bit
73-
- macOS_ARM64
66+
- dist: Windows_32bit
67+
path: "*Windows_32bit.zip"
68+
name: Windows_X86-32
69+
- dist: Windows_64bit
70+
path: "*Windows_64bit.zip"
71+
name: Windows_X86-64
72+
- dist: Linux_32bit
73+
path: "*Linux_32bit.tar.gz"
74+
name: Linux_X86-32
75+
- dist: Linux_64bit
76+
path: "*Linux_64bit.tar.gz"
77+
name: Linux_X86-64
78+
- dist: Linux_ARMv6
79+
path: "*Linux_ARMv6.tar.gz"
80+
name: Linux_ARMv6
81+
- dist: Linux_ARMv7
82+
path: "*Linux_ARMv7.tar.gz"
83+
name: Linux_ARMv7
84+
- dist: Linux_ARM64
85+
path: "*Linux_ARM64.tar.gz"
86+
name: Linux_ARM64
87+
- dist: macOS_64bit
88+
path: "*macOS_64bit.tar.gz"
89+
name: macOS_64
90+
- dist: macOS_ARM64
91+
path: "*macOS_ARM64.tar.gz"
92+
name: macOS_ARM64
7493

7594
steps:
7695
- name: Checkout repository
@@ -92,54 +111,25 @@ jobs:
92111
fi
93112
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
94113
export PACKAGE_NAME_PREFIX
95-
task dist:${{ matrix.os }}
114+
task dist:${{ matrix.os.dist }}
96115
97-
# Transfer builds to artifacts job
98-
- name: Upload combined builds artifact
116+
- name: Upload build artifact
99117
uses: actions/upload-artifact@v3
100118
with:
101-
path: ${{ env.DIST_DIR }}
102-
name: ${{ env.BUILDS_ARTIFACT }}
119+
path: ${{ env.DIST_DIR }}/${{ matrix.os.path }}
120+
name: ${{ matrix.os.name }}
103121

104-
artifacts:
105-
name: ${{ matrix.artifact.name }} artifact
122+
checksums:
106123
needs: build
107124
runs-on: ubuntu-latest
108125

109-
strategy:
110-
matrix:
111-
artifact:
112-
- path: "*checksums.txt"
113-
name: checksums
114-
- path: "*Linux_32bit.tar.gz"
115-
name: Linux_X86-32
116-
- path: "*Linux_64bit.tar.gz"
117-
name: Linux_X86-64
118-
- path: "*Linux_ARM64.tar.gz"
119-
name: Linux_ARM64
120-
- path: "*Linux_ARMv6.tar.gz"
121-
name: Linux_ARMv6
122-
- path: "*Linux_ARMv7.tar.gz"
123-
name: Linux_ARMv7
124-
- path: "*macOS_64bit.tar.gz"
125-
name: macOS_64
126-
- path: "*macOS_ARM64.tar.gz"
127-
name: macOS_ARM64
128-
- path: "*Windows_32bit.zip"
129-
name: Windows_X86-32
130-
- path: "*Windows_64bit.zip"
131-
name: Windows_X86-64
132-
133126
steps:
134-
- name: Download combined builds artifact
127+
- name: Download build artifacts
135128
uses: actions/download-artifact@v3
136129
with:
137-
name: ${{ env.BUILDS_ARTIFACT }}
138130
path: ${{ env.BUILDS_ARTIFACT }}
139131

140-
# Calculate checksums once
141132
- name: Output checksum
142-
if: matrix.artifact.name == 'checksums'
143133
working-directory: ${{ env.BUILDS_ARTIFACT}}
144134
run: |
145135
PACKAGE_NAME_PREFIX="test"
@@ -148,20 +138,17 @@ jobs:
148138
fi
149139
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
150140
TAG="${PACKAGE_NAME_PREFIX}git-snapshot"
151-
sha256sum ${{ env.PROJECT_NAME }}_${TAG}* >> ${TAG}-checksums.txt
152-
153-
- name: Upload individual build artifact
141+
declare -a artifacts=($(ls -d */))
142+
for artifact in ${artifacts[@]}
143+
do
144+
cd $artifact
145+
checksum=$(sha256sum ${{ env.PROJECT_NAME }}_${TAG}*)
146+
cd ..
147+
echo $checksum >> ${TAG}-checksums.txt
148+
done
149+
150+
- name: Upload checksum artifact
154151
uses: actions/upload-artifact@v3
155152
with:
156-
path: ${{ env.BUILDS_ARTIFACT }}/${{ matrix.artifact.path }}
157-
name: ${{ matrix.artifact.name }}
158-
159-
clean:
160-
needs: artifacts
161-
runs-on: ubuntu-latest
162-
163-
steps:
164-
- name: Remove unneeded combined builds artifact
165-
uses: geekyeggo/delete-artifact@v1
166-
with:
167-
name: ${{ env.BUILDS_ARTIFACT }}
153+
path: ${{ env.BUILDS_ARTIFACT }}/*checksums.txt
154+
name: checksums

0 commit comments

Comments
 (0)