Skip to content

Commit 624f905

Browse files
committed
Move nightly build checksum generation to dedicated job
The "Publish Nightly Build" GitHub Actions workflow calculates checksums of the generated builds and writes them to a file. This file may be used to validate downloads of the builds. In addition to uploading the builds to Arduino's downloads server, the workflow also uploads them to GitHub Actions workflow artifacts. These artifacts may serve as an alternative source of the nightly builds (similar to the tester builds). Previously the checksum generation was performed in the workflow's "publish-nightly" job, which is used to upload the builds to Arduino's downloads server. In addition to being outside the stated scope of that job, this also meant that the checksum file was only available from Arduino's downloads server, and not from the workflow artifacts. Moving the checksum generation code to a dedicated job limits the operations in the important "publish-nightly" job exclusively to its stated scope. This also results in the checksum file being available as a workflow artifact.
1 parent 4532c38 commit 624f905

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

.github/workflows/publish-go-nightly-task.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,43 @@ jobs:
219219
overwrite: true
220220
path: ${{ env.DIST_DIR }}/${{ env.PACKAGE_FILENAME }}
221221

222+
checksums:
223+
needs: notarize-macos
224+
runs-on: ubuntu-latest
225+
permissions:
226+
contents: read
227+
228+
steps:
229+
- name: Set environment variables
230+
run: |
231+
# See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#setting-an-environment-variable
232+
TAG="nightly-$(date -u +"%Y%m%d")"
233+
echo "CHECKSUM_FILE_PATH=${{ runner.temp }}/${TAG}-checksums.txt" >>"$GITHUB_ENV"
234+
echo "TAG=$TAG" >>"$GITHUB_ENV"
235+
236+
- name: Download artifacts
237+
uses: actions/download-artifact@v6
238+
with:
239+
merge-multiple: true
240+
path: ${{ env.DIST_DIR }}
241+
pattern: ${{ env.ARTIFACT_PREFIX }}*
242+
243+
- name: Create checksum file
244+
working-directory: ${{ env.DIST_DIR }}
245+
run: |
246+
sha256sum ${{ env.PROJECT_NAME }}_${{ env.TAG }}* >"${{ env.CHECKSUM_FILE_PATH }}"
247+
248+
- name: Upload checksum artifact
249+
uses: actions/upload-artifact@v5
250+
with:
251+
if-no-files-found: error
252+
name: ${{ env.ARTIFACT_PREFIX }}checksums
253+
path: ${{ env.CHECKSUM_FILE_PATH }}
254+
222255
publish-nightly:
223256
runs-on: ubuntu-latest
224257
environment: production
225-
needs: notarize-macos
258+
needs: checksums
226259
permissions:
227260
contents: write
228261
id-token: write # This is required for requesting the JWT
@@ -235,12 +268,6 @@ jobs:
235268
merge-multiple: true
236269
path: ${{ env.DIST_DIR }}
237270

238-
- name: Create checksum file
239-
working-directory: ${{ env.DIST_DIR }}
240-
run: |
241-
TAG="nightly-$(date -u +"%Y%m%d")"
242-
sha256sum ${{ env.PROJECT_NAME }}_${TAG}* >${TAG}-checksums.txt
243-
244271
- name: configure aws credentials
245272
uses: aws-actions/configure-aws-credentials@v5
246273
with:

0 commit comments

Comments
 (0)