@@ -19,13 +19,28 @@ jobs:
1919 create-release-artifacts :
2020 runs-on : ubuntu-latest
2121
22+ strategy :
23+ matrix :
24+ os :
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
34+
2235 steps :
2336 - name : Checkout repository
2437 uses : actions/checkout@v3
2538 with :
2639 fetch-depth : 0
2740
2841 - name : Create changelog
42+ # Avoid creating the same changelog for each os
43+ if : matrix.os == 'Windows_32bit'
2944 uses : arduino/create-changelog@v1
3045 with :
3146 tag-regex : ' ^[0-9]+\.[0-9]+\.[0-9]+.*$'
@@ -40,15 +55,15 @@ jobs:
4055 version : 3.x
4156
4257 - name : Build
43- run : task dist:all
58+ run : task dist:${{ matrix.os }}
4459
4560 - name : Upload artifacts
4661 uses : actions/upload-artifact@v3
4762 with :
4863 if-no-files-found : error
4964 name : ${{ env.ARTIFACT_NAME }}
5065 path : ${{ env.DIST_DIR }}
51-
66+
5267 notarize-macos :
5368 name : Notarize ${{ matrix.artifact.name }}
5469 runs-on : macos-latest
8297 env :
8398 KEYCHAIN : " sign.keychain"
8499 INSTALLER_CERT_MAC_PATH : " /tmp/ArduinoCerts2020.p12"
85- KEYCHAIN_PASSWORD : keychainpassword # Arbitrary password for a keychain that exists only for the duration of the job, so not secret
100+ # Arbitrary password for a keychain that exists only for the duration of the job, so not secret
101+ KEYCHAIN_PASSWORD : keychainpassword
86102 run : |
87103 echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}"
88104 security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
@@ -132,14 +148,10 @@ jobs:
132148 run : |
133149 gon "${{ env.GON_CONFIG_PATH }}"
134150
135- - name : Re-package binary and output checksum
151+ - name : Re-package binary
136152 id : re-package
137153 working-directory : ${{ env.DIST_DIR }}
138- # This step performs the following:
139- # 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
140- # 2. Recalculate package checksum
141- # 3. Output the new checksum to include in the nnnnnn-checksums.txt file
142- # (it cannot be done there because of workflow job parallelization)
154+ # Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
143155 run : |
144156 # GitHub's upload/download-artifact actions don't preserve file permissions,
145157 # so we need to add execution permission back until the action is made to do this.
@@ -149,11 +161,9 @@ jobs:
149161 tar -czvf "$PACKAGE_FILENAME" \
150162 -C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
151163 -C ../../ LICENSE.txt
152- CHECKSUM_LINE="$(shasum -a 256 $PACKAGE_FILENAME)"
153164 echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
154- echo "::set-output name=checksum-${{ matrix.artifact.name }}::$CHECKSUM_LINE"
155165
156- - name : Upload artifacts
166+ - name : Upload artifact
157167 uses : actions/upload-artifact@v3
158168 with :
159169 if-no-files-found : error
@@ -170,25 +180,29 @@ jobs:
170180 with :
171181 name : ${{ env.ARTIFACT_NAME }}
172182 path : ${{ env.DIST_DIR }}
173-
174- - name : Update checksum
183+
184+ - name : Create checksum file
185+ working-directory : ${{ env.DIST_DIR}}
175186 run : |
176- declare -a checksum_lines=("${{ needs.notarize-macos.outputs.checksum-darwin_amd64 }}" "${{ needs.notarize-macos.outputs.checksum-darwin_arm64 }}")
177- for checksum_line in "${checksum_lines[@]}"
178- do
179- CHECKSUM=$(echo ${checksum_line} | cut -d " " -f 1)
180- PACKAGE_FILENAME=$(echo ${checksum_line} | cut -d " " -f 2)
181- perl -pi -w -e "s/.*${PACKAGE_FILENAME}/${CHECKSUM} ${PACKAGE_FILENAME}/g;" ${{ env.DIST_DIR }}/*-checksums.txt
182- done
187+ TAG="${GITHUB_REF/refs\/tags\//}"
188+ sha256sum ${{ env.PROJECT_NAME }}_${TAG}* > ${TAG}-checksums.txt
183189
184190 - name : Identify Prerelease
185191 # This is a workaround while waiting for create-release action
186192 # to implement auto pre-release based on tag
187193 id : prerelease
188194 run : |
189- wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.0.0.zip
190- unzip -p /tmp/3.0.0.zip semver-tool-3.0.0/src/semver >/tmp/semver && chmod +x /tmp/semver
191- if [[ "$(/tmp/semver get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then echo "::set-output name=IS_PRE::true"; fi
195+ wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.2.0.zip
196+ unzip -p /tmp/3.2.0.zip semver-tool-3.2.0/src/semver >/tmp/semver && chmod +x /tmp/semver
197+ if [[ \
198+ "$(
199+ /tmp/semver get prerel \
200+ "${GITHUB_REF/refs\/tags\//}"
201+ )" != \
202+ "" \
203+ ]]; then
204+ echo "IS_PRE=true" >> $GITHUB_OUTPUT
205+ fi
192206
193207 - name : Create Github Release and upload artifacts
194208 uses : ncipollo/release-action@v1
0 commit comments