2626env :
2727  #  See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
2828  GO_VERSION : " 1.18" 
29+   #  As defined by the Taskfile's PROJECT_NAME variable
30+   PROJECT_NAME : arduino-fwuploader 
2931  #  As defined by the Taskfile's DIST_DIR variable
3032  DIST_DIR : dist 
31-   BUILDS_ARTIFACT : build-artifacts 
3233
3334jobs :
3435  run-determination :
@@ -40,10 +41,12 @@ jobs:
4041        id : determination 
4142        run : | 
4243          RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 
44+           TAG_REGEX="refs/tags/.*" 
4345          # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 
4446          if [[ 
45-             "${{ github.event_name }}" != "create" || 
46-             "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 
47+             ("${{ github.event_name }}" != "create" || 
48+             "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX) && 
49+             ! "${{ github.ref }}" =~ $TAG_REGEX 
4750          ]]; then 
4851            # Run the other jobs. 
4952            RESULT="true" 
@@ -52,12 +55,61 @@ jobs:
5255            RESULT="false" 
5356          fi 
5457
55-           echo "::set-output name= result:: $RESULT" 
58+           echo "result= $RESULT" >> $GITHUB_OUTPUT  
5659
57-    build :
60+    package-name-prefix :
5861    needs : run-determination 
5962    if : needs.run-determination.outputs.result == 'true' 
6063    runs-on : ubuntu-latest 
64+     outputs :
65+       prefix : ${{ steps.calculation.outputs.prefix }} 
66+     steps :
67+       - name : package name prefix calculation 
68+         id : calculation 
69+         run : | 
70+           PACKAGE_NAME_PREFIX="test" 
71+           if [ "${{ github.event_name }}" = "pull_request" ]; then 
72+             PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}" 
73+           fi 
74+           PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-" 
75+ 
76+           echo "prefix=$PACKAGE_NAME_PREFIX" >> $GITHUB_OUTPUT 
77+ 
78+    build :
79+     needs : package-name-prefix 
80+     name : Build ${{ matrix.os.name }} 
81+     runs-on : ubuntu-latest 
82+ 
83+     strategy :
84+       matrix :
85+         os :
86+           - task : Windows_32bit 
87+             path : " *Windows_32bit.zip" 
88+             name : Windows_X86-32 
89+           - task : Windows_64bit 
90+             path : " *Windows_64bit.zip" 
91+             name : Windows_X86-64 
92+           - task : Linux_32bit 
93+             path : " *Linux_32bit.tar.gz" 
94+             name : Linux_X86-32 
95+           - task : Linux_64bit 
96+             path : " *Linux_64bit.tar.gz" 
97+             name : Linux_X86-64 
98+           - task : Linux_ARMv6 
99+             path : " *Linux_ARMv6.tar.gz" 
100+             name : Linux_ARMv6 
101+           - task : Linux_ARMv7 
102+             path : " *Linux_ARMv7.tar.gz" 
103+             name : Linux_ARMv7 
104+           - task : Linux_ARM64 
105+             path : " *Linux_ARM64.tar.gz" 
106+             name : Linux_ARM64 
107+           - task : macOS_64bit 
108+             path : " *macOS_64bit.tar.gz" 
109+             name : macOS_64 
110+           - task : macOS_ARM64 
111+             path : " *macOS_ARM64.tar.gz" 
112+             name : macOS_ARM64 
61113
62114    steps :
63115      - name : Checkout repository 
@@ -76,69 +128,41 @@ jobs:
76128
77129      - name : Build 
78130        run : | 
79-           PACKAGE_NAME_PREFIX="test" 
80-           if [ "${{ github.event_name }}" = "pull_request" ]; then 
81-             PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}" 
82-           fi 
83-           PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-" 
131+           PACKAGE_NAME_PREFIX=${{ needs.package-name-prefix.outputs.prefix }} 
84132          export PACKAGE_NAME_PREFIX 
85-           task dist:all  
133+           task dist:${{ matrix.os.task }}  
86134
87135       #  Transfer builds to artifacts job
88-       - name : Upload combined builds  artifact 
136+       - name : Upload build  artifact 
89137        uses : actions/upload-artifact@v3 
90138        with :
91-           path : ${{ env.DIST_DIR }} 
92-           name : ${{ env.BUILDS_ARTIFACT  }} 
139+           path : ${{ env.DIST_DIR }}/${{ matrix.os.path }}  
140+           name : ${{ matrix.os.name  }} 
93141
94-   artifacts :
95-     name : ${{ matrix.artifact.name }} artifact 
96-     needs : build 
142+   checksums :
143+     needs :
144+       - build 
145+       - package-name-prefix 
97146    runs-on : ubuntu-latest 
98147
99-     strategy :
100-       matrix :
101-         artifact :
102-           - path : " *checksums.txt" 
103-             name : checksums 
104-           - path : " *Linux_32bit.tar.gz" 
105-             name : Linux_X86-32 
106-           - path : " *Linux_64bit.tar.gz" 
107-             name : Linux_X86-64 
108-           - path : " *Linux_ARM64.tar.gz" 
109-             name : Linux_ARM64 
110-           - path : " *Linux_ARMv6.tar.gz" 
111-             name : Linux_ARMv6 
112-           - path : " *Linux_ARMv7.tar.gz" 
113-             name : Linux_ARMv7 
114-           - path : " *macOS_64bit.tar.gz" 
115-             name : macOS_64 
116-           - path : " *macOS_ARM64.tar.gz" 
117-             name : macOS_ARM64 
118-           - path : " *Windows_32bit.zip" 
119-             name : Windows_X86-32 
120-           - path : " *Windows_64bit.zip" 
121-             name : Windows_X86-64 
122- 
123148    steps :
124-       - name : Download combined builds artifact  
149+       - name : Download build artifacts  
125150        uses : actions/download-artifact@v3 
126-         with :
127-           name : ${{ env.BUILDS_ARTIFACT }} 
128-           path : ${{ env.BUILDS_ARTIFACT }} 
129151
130-       - name : Upload individual build artifact 
152+       - name : Create checksum file 
153+         run : | 
154+           TAG="${{ needs.package-name-prefix.outputs.prefix }}git-snapshot" 
155+           declare -a artifacts=($(ls -d */)) 
156+           for artifact in ${artifacts[@]} 
157+           do 
158+             cd $artifact 
159+             checksum=$(sha256sum ${{ env.PROJECT_NAME }}_${TAG}*) 
160+             cd .. 
161+             echo $checksum >> ${TAG}-checksums.txt 
162+           done 
163+ 
164+        - name : Upload checksum artifact 
131165        uses : actions/upload-artifact@v3 
132166        with :
133-           path : ${{ env.BUILDS_ARTIFACT }}/${{ matrix.artifact.path }} 
134-           name : ${{ matrix.artifact.name }} 
135- 
136-   clean :
137-     needs : artifacts 
138-     runs-on : ubuntu-latest 
139- 
140-     steps :
141-       - name : Remove unneeded combined builds artifact 
142-         uses : geekyeggo/delete-artifact@v2 
143-         with :
144-           name : ${{ env.BUILDS_ARTIFACT }} 
167+           path : ./*checksums.txt 
168+           name : checksums 
0 commit comments