88 DIST_DIR : dist
99 # The project's folder on Arduino's download server for uploading builds
1010 AWS_PLUGIN_TARGET : /arduinoOTA/
11- ARTIFACT_NAME : dist
11+ ARTIFACT_PREFIX : dist-
1212 # See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
1313 GO_VERSION : " 1.17"
1414
@@ -24,15 +24,24 @@ jobs:
2424 strategy :
2525 matrix :
2626 os :
27- - Windows_32bit
28- - Windows_64bit
29- - Linux_32bit
30- - Linux_64bit
31- - Linux_ARMv6
32- - Linux_ARMv7
33- - Linux_ARM64
34- - macOS_64bit
35- - macOS_ARM64
27+ - task : Windows_32bit
28+ artifact-suffix : Windows_32bit
29+ - task : Windows_64bit
30+ artifact-suffix : Windows_64bit
31+ - task : Linux_32bit
32+ artifact-suffix : Linux_32bit
33+ - task : Linux_64bit
34+ artifact-suffix : Linux_64bit
35+ - task : Linux_ARMv6
36+ artifact-suffix : Linux_ARMv6
37+ - task : Linux_ARMv7
38+ artifact-suffix : Linux_ARMv7
39+ - task : Linux_ARM64
40+ artifact-suffix : Linux_ARM64
41+ - task : macOS_64bit
42+ artifact-suffix : macOS_64bit
43+ - task : macOS_ARM64
44+ artifact-suffix : macOS_ARM64
3645
3746 steps :
3847 - name : Checkout repository
4251
4352 - name : Create changelog
4453 # Avoid creating the same changelog for each os
45- if : matrix.os == 'Windows_32bit'
54+ if : matrix.os.task == 'Windows_32bit'
4655 uses : arduino/create-changelog@v1
4756 with :
4857 tag-regex : ' ^[0-9]+\.[0-9]+\.[0-9]+.*$'
@@ -62,17 +71,17 @@ jobs:
6271 version : 3.x
6372
6473 - name : Build
65- run : task dist:${{ matrix.os }}
74+ run : task dist:${{ matrix.os.task }}
6675
6776 - name : Upload artifacts
68- uses : actions/upload-artifact@v3
77+ uses : actions/upload-artifact@v4
6978 with :
7079 if-no-files-found : error
71- name : ${{ env.ARTIFACT_NAME }}
80+ name : ${{ env.ARTIFACT_PREFIX }}${{ matrix.os.artifact-suffix }}
7281 path : ${{ env.DIST_DIR }}
7382
7483 notarize-macos :
75- name : Notarize ${{ matrix.artifact.name }}
84+ name : Notarize ${{ matrix.build.artifact-suffix }}
7685 runs-on : macos-latest
7786 needs : create-release-artifacts
7887 outputs :
@@ -84,22 +93,36 @@ jobs:
8493
8594 strategy :
8695 matrix :
87- artifact :
88- - name : darwin_amd64
89- path : " macOS_64bit.tar.gz"
90- - name : darwin_arm64
91- path : " macOS_ARM64.tar.gz"
96+ build :
97+ - artifact-suffix : macOS_64bit
98+ folder-suffix : darwin_amd64
99+ package-suffix : " macOS_64bit.tar.gz"
100+ - artifact-suffix : macOS_ARM64
101+ folder-suffix : darwin_arm64
102+ package-suffix : " macOS_ARM64.tar.gz"
92103
93104 steps :
105+ - name : Set environment variables
106+ run : |
107+ # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
108+ echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >> "$GITHUB_ENV"
109+ TAG="${GITHUB_REF/refs\/tags\//}"
110+ echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >> $GITHUB_ENV
111+
94112 - name : Checkout repository
95113 uses : actions/checkout@v4
96114
97115 - name : Download artifacts
98- uses : actions/download-artifact@v3
116+ uses : actions/download-artifact@v4
99117 with :
100- name : ${{ env.ARTIFACT_NAME }}
118+ name : ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
101119 path : ${{ env.DIST_DIR }}
102120
121+ - name : Remove non-notarized artifact
122+ uses : geekyeggo/delete-artifact@v5
123+ with :
124+ name : ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
125+
103126 - name : Import Code-Signing Certificates
104127 env :
105128 KEYCHAIN : " sign.keychain"
@@ -133,7 +156,7 @@ jobs:
133156 run : |
134157 cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
135158 # See: https://github.com/Bearer/gon#configuration-file
136- source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"]
159+ source = ["${{ env.DIST_DIR }}/${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"]
137160 bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
138161
139162 sign {
@@ -162,17 +185,14 @@ jobs:
162185 run : |
163186 # GitHub's upload/download-artifact actions don't preserve file permissions,
164187 # so we need to add execution permission back until the action is made to do this.
165- chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"
166- TAG="${GITHUB_REF/refs\/tags\//}"
167- PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.artifact.path }}"
168- tar -czvf "$PACKAGE_FILENAME" "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}"
169- echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
188+ chmod +x "${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"
189+ tar -czvf "${{ env.PACKAGE_FILENAME }}" "${{ env.BUILD_FOLDER }}/"
170190
171- - name : Upload artifact
172- uses : actions/upload-artifact@v3
191+ - name : Upload notarized artifact
192+ uses : actions/upload-artifact@v4
173193 with :
174194 if-no-files-found : error
175- name : ${{ env.ARTIFACT_NAME }}
195+ name : ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
176196 path : ${{ env.DIST_DIR }}/${{ env.PACKAGE_FILENAME }}
177197
178198 create-release :
@@ -181,10 +201,11 @@ jobs:
181201
182202 steps :
183203 - name : Download artifact
184- uses : actions/download-artifact@v3
204+ uses : actions/download-artifact@v4
185205 with :
186- name : ${{ env.ARTIFACT_NAME }}
206+ merge-multiple : true
187207 path : ${{ env.DIST_DIR }}
208+ pattern : ${{ env.ARTIFACT_PREFIX }}*
188209
189210 - name : Create checksum file
190211 working-directory : ${{ env.DIST_DIR}}
0 commit comments