2222
2323jobs :
2424 build :
25+ outputs :
26+ output_linux-x86_64 : ${{ steps.set-outputs.outputs.output_linux-x86_64 }}
27+ output_linux-x86_64-static : ${{ steps.set-outputs.outputs.output_linux-x86_64-static }}
28+ output_macos-x86_64 : ${{ steps.set-outputs.outputs.output_macos-x86_64 }}
29+ output_macos-aarch64 : ${{ steps.set-outputs.outputs.output_macos-aarch64 }}
30+
2531 strategy :
2632 fail-fast : false
2733
9298 steps :
9399 - uses : actions/checkout@v6
94100
101+ - name : Compute artifact names
102+ uses : ./.github/actions/compute-artifact-names
103+ id : compute-artifact-names
104+ with :
105+ build-name : ${{ matrix.env.name }}
106+
95107 - name : Install dependencies
96108 if : ${{ matrix.env.install-deps }}
97109 run : ${{ matrix.env.install-deps }}
@@ -112,52 +124,82 @@ jobs:
112124 run : |
113125 ./run build:all${{ matrix.env.static && ':static' || '' }}
114126 mkdir -p artifacts
115- ./tools/make_binary_package.sh "artifacts/wasp- ${{ matrix.env. name }}.tar.gz "
127+ ./tools/make_binary_package.sh "artifacts/${{ steps.compute-artifact-names.outputs.tarball- name }}"
116128
117129 - uses : actions/upload-artifact@v4
118130 with :
119- path : ./waspc/artifacts/*
120- name :
121- " wasp-cli-${{ matrix.env.name }}"
122- # This name must be in sync with the artifact name used in:
123- # /.github/actions/fetch-nightly-cli/action.yaml
131+ path : ./waspc/artifacts/${{ steps.compute-artifact-names.outputs.tarball-name }}
132+ name : ${{ steps.compute-artifact-names.outputs.artifact-name }}
124133 if-no-files-found : error
125134
135+ - name : Set job outputs
136+ id : set-outputs
137+ env :
138+ OUTPUT_DATA : ${{ toJson(steps.compute-artifact-names.outputs) }}
139+ run : |
140+ {
141+ echo 'output_${{ matrix.env.name }}<<EOF'
142+ echo "$OUTPUT_DATA"
143+ echo 'EOF'
144+ } >> $GITHUB_OUTPUT
145+
126146 build-universal :
127147 name : Build Wasp (universal)
128148 needs : build
129149 runs-on : macos-15
150+
151+ env :
152+ X86_64_TARBALL_NAME : ${{ fromJson(needs.build.outputs.output_macos-x86_64).tarball-name }}
153+ X86_64_ARTIFACT_NAME : ${{ fromJson(needs.build.outputs.output_macos-x86_64).artifact-name }}
154+ AARCH64_TARBALL_NAME : ${{ fromJson(needs.build.outputs.output_macos-aarch64).tarball-name }}
155+ AARCH64_ARTIFACT_NAME : ${{ fromJson(needs.build.outputs.output_macos-aarch64).artifact-name }}
156+
130157 steps :
131- - name : Download macOS binaries
158+ - uses : actions/checkout@v6
159+
160+ - name : Compute artifact names
161+ uses : ./.github/actions/compute-artifact-names
162+ id : compute-artifact-names
163+ with :
164+ build-name : macos-universal
165+
166+ - name : Download macOS Intel binaries
167+ uses : actions/download-artifact@v5
168+ with :
169+ name : " ${{ env.X86_64_ARTIFACT_NAME }}"
170+
171+ - name : Download macOS ARM binaries
132172 uses : actions/download-artifact@v5
133173 with :
134- pattern : wasp-cli-macos-*
174+ name : " ${{ env.AARCH64_ARTIFACT_NAME }} "
135175
136176 - name : Unpack, create universal binary and pack
137177 run : |
138178 set -ex # Fail on error and print each command
139179
140- input_arch =(
141- macos-x86_64
142- macos-aarch64
180+ input_files =(
181+ "$X86_64_TARBALL_NAME"
182+ "$AARCH64_TARBALL_NAME"
143183 )
144184
145185 # Extract each architecture
146- for arch in "${input_arch[@]}"; do
147- mkdir "arch-$arch"
148- tar -xzf "wasp-cli-${arch}/wasp-${arch}.tar.gz" -C "arch-$arch"
186+ i=0;
187+ for file in "${input_files[@]}"; do
188+ mkdir "arch-$i"
189+ tar -xzf "$file" -C "arch-$i"
190+ i=$((i + 1))
149191 done
150192
151193 mkdir universal
152194 # Create the universal binary
153195 lipo -create arch-*/wasp-bin -output universal/wasp-bin
154- # Copy the data folder too
155- cp -R "arch-${input_arch[0]} /data" universal/
196+ # Copy the data folder too (we take the first one, should be identical in both)
197+ cp -R "arch-0 /data" universal/
156198
157199 # Pack back up
158- tar -czf wasp-macos-universal.tar.gz -C universal .
200+ tar -czf ${{ steps.compute-artifact-names.outputs.tarball-name }} -C universal .
159201
160202 - uses : actions/upload-artifact@v4
161203 with :
162- name : wasp-cli-macos-universal
163- path : ./wasp-macos-universal.tar.gz
204+ name : ${{ steps.compute-artifact-names.outputs.artifact-name }}
205+ path : ./${{ steps.compute-artifact-names.outputs.tarball-name }}
0 commit comments