2828 PROJECT_NAME : arduino-cli
2929 # As defined by the Taskfile's DIST_DIR variable
3030 DIST_DIR : dist
31- BUILDS_ARTIFACT : build-artifacts
3231
3332jobs :
3433 run-determination :
@@ -54,40 +53,57 @@ jobs:
5453
5554 echo "::set-output name=result::$RESULT"
5655
57- build :
58- name : Build ${{ matrix.os.name }}
56+ package-name-prefix :
5957 needs : run-determination
6058 if : needs.run-determination.outputs.result == 'true'
6159 runs-on : ubuntu-latest
60+ outputs :
61+ prefix : ${{ steps.calculation.outputs.prefix }}
62+ steps :
63+ - name : package name prefix calculation
64+ id : calculation
65+ run : |
66+ PACKAGE_NAME_PREFIX="test"
67+ if [ "${{ github.event_name }}" = "pull_request" ]; then
68+ PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
69+ fi
70+ PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
71+
72+ echo "::set-output name=prefix::$PACKAGE_NAME_PREFIX"
73+
74+ build :
75+ needs : package-name-prefix
76+ name : Build ${{ matrix.os.name }}
77+ runs-on : ubuntu-latest
6278
6379 strategy :
6480 matrix :
6581 os :
66- - dist : Windows_32bit
82+ - task : Windows_32bit
6783 path : " *Windows_32bit.zip"
6884 name : Windows_X86-32
69- - dist : Windows_64bit
85+ - task : Windows_64bit
7086 path : " *Windows_64bit.zip"
7187 name : Windows_X86-64
72- - dist : Linux_32bit
88+ - task : Linux_32bit
7389 path : " *Linux_32bit.tar.gz"
7490 name : Linux_X86-32
75- - dist : Linux_64bit
91+ - task : Linux_64bit
7692 path : " *Linux_64bit.tar.gz"
7793 name : Linux_X86-64
78- - dist : Linux_ARMv6
94+ - task : Linux_ARMv6
7995 path : " *Linux_ARMv6.tar.gz"
8096 name : Linux_ARMv6
81- - dist : Linux_ARMv7
97+ - task : Linux_ARMv7
8298 path : " *Linux_ARMv7.tar.gz"
8399 name : Linux_ARMv7
84- - dist : Linux_ARM64
100+ - task : Linux_ARM64
85101 path : " *Linux_ARM64.tar.gz"
86102 name : Linux_ARM64
87- - dist : macOS_64bit
103+ - task : macOS_64bit
88104 path : " *macOS_64bit.tar.gz"
89105 name : macOS_64
90- - dist : macOS_ARM64
106+ - task : macOS_ARM64
91107 path : " *macOS_ARM64.tar.gz"
92108 name : macOS_ARM64
93109
@@ -105,39 +121,30 @@ jobs:
105121
106122 - name : Build
107123 run : |
108- PACKAGE_NAME_PREFIX="test"
109- if [ "${{ github.event_name }}" = "pull_request" ]; then
110- PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
111- fi
112- PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
124+ PACKAGE_NAME_PREFIX=${{ needs.package-name-prefix.outputs.prefix }}
113125 export PACKAGE_NAME_PREFIX
114- task dist:${{ matrix.os.dist }}
126+ task dist:${{ matrix.os.task }}
115127
128+ # Transfer builds to artifacts job
116129 - name : Upload build artifact
117130 uses : actions/upload-artifact@v3
118131 with :
119132 path : ${{ env.DIST_DIR }}/${{ matrix.os.path }}
120133 name : ${{ matrix.os.name }}
121134
122135 checksums :
123- needs : build
136+ needs :
137+ - build
138+ - package-name-prefix
124139 runs-on : ubuntu-latest
125140
126141 steps :
127142 - name : Download build artifacts
128143 uses : actions/download-artifact@v3
129- with :
130- path : ${{ env.BUILDS_ARTIFACT }}
131144
132145 - name : Output checksum
133- working-directory : ${{ env.BUILDS_ARTIFACT}}
134146 run : |
135- PACKAGE_NAME_PREFIX="test"
136- if [ "${{ github.event_name }}" = "pull_request" ]; then
137- PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
138- fi
139- PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
140- TAG="${PACKAGE_NAME_PREFIX}git-snapshot"
147+ TAG="${{ needs.package-name-prefix.outputs.prefix }}git-snapshot"
141148 declare -a artifacts=($(ls -d */))
142149 for artifact in ${artifacts[@]}
143150 do
@@ -150,5 +157,5 @@ jobs:
150157 - name : Upload checksum artifact
151158 uses : actions/upload-artifact@v3
152159 with :
153- path : ${{ env.BUILDS_ARTIFACT }} /*checksums.txt
160+ path : . /*checksums.txt
154161 name : checksums
0 commit comments