Skip to content

Commit 335245c

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 335245c

File tree

1 file changed

+44
-58
lines changed

1 file changed

+44
-58
lines changed

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

+44-58
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,33 @@ jobs:
6262
strategy:
6363
matrix:
6464
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
65+
- dist: Windows_32bit
66+
path: "*Windows_32bit.zip"
67+
name: Windows_X86-32
68+
- dist: Windows_64bit
69+
path: "*Windows_64bit.zip"
70+
name: Windows_X86-64
71+
- dist: Linux_32bit
72+
path: "*Linux_32bit.tar.gz"
73+
name: Linux_X86-32
74+
- dist: Linux_64bit
75+
path: "*Linux_64bit.tar.gz"
76+
name: Linux_X86-64
77+
- dist: Linux_ARMv6
78+
path: "*Linux_ARMv6.tar.gz"
79+
name: Linux_ARMv6
80+
- dist: Linux_ARMv7
81+
path: "*Linux_ARMv7.tar.gz"
82+
name: Linux_ARMv7
83+
- dist: Linux_ARM64
84+
path: "*Linux_ARM64.tar.gz"
85+
name: Linux_ARM64
86+
- dist: macOS_64bit
87+
path: "*macOS_64bit.tar.gz"
88+
name: macOS_64
89+
- dist: macOS_ARM64
90+
path: "*macOS_ARM64.tar.gz"
91+
name: macOS_ARM64
7492

7593
steps:
7694
- name: Checkout repository
@@ -92,54 +110,25 @@ jobs:
92110
fi
93111
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
94112
export PACKAGE_NAME_PREFIX
95-
task dist:${{ matrix.os }}
113+
task dist:${{ matrix.os.dist }}
96114
97-
# Transfer builds to artifacts job
98-
- name: Upload combined builds artifact
115+
- name: Upload build artifact
99116
uses: actions/upload-artifact@v3
100117
with:
101118
path: ${{ env.DIST_DIR }}
102-
name: ${{ env.BUILDS_ARTIFACT }}
119+
name: ${{ matrix.os.name }}
103120

104-
artifacts:
105-
name: ${{ matrix.artifact.name }} artifact
121+
checksums:
106122
needs: build
107123
runs-on: ubuntu-latest
108124

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-
133125
steps:
134-
- name: Download combined builds artifact
126+
- name: Download build artifacts
135127
uses: actions/download-artifact@v3
136128
with:
137-
name: ${{ env.BUILDS_ARTIFACT }}
138129
path: ${{ env.BUILDS_ARTIFACT }}
139130

140-
# Calculate checksums once
141131
- name: Output checksum
142-
if: matrix.artifact.name == 'checksums'
143132
working-directory: ${{ env.BUILDS_ARTIFACT}}
144133
run: |
145134
PACKAGE_NAME_PREFIX="test"
@@ -148,20 +137,17 @@ jobs:
148137
fi
149138
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
150139
TAG="${PACKAGE_NAME_PREFIX}git-snapshot"
151-
sha256sum ${{ env.PROJECT_NAME }}_${TAG}* >> ${TAG}-checksums.txt
152-
153-
- name: Upload individual build artifact
140+
declare -a artifacts=($(ls -d */))
141+
for artifact in ${artifacts[@]}
142+
do
143+
cd $artifact
144+
checksum=$(sha256sum ${{ env.PROJECT_NAME }}_${TAG}*)
145+
cd ..
146+
echo $checksum >> ${TAG}-checksums.txt
147+
done
148+
149+
- name: Upload checksum artifact
154150
uses: actions/upload-artifact@v3
155151
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 }}
152+
path: ${{ env.BUILDS_ARTIFACT }}/*checksums.txt
153+
name: checksums

0 commit comments

Comments
 (0)