@@ -326,6 +326,110 @@ jobs:
326326 env :
327327 GITHUB_TOKEN : ${{ github.token }}
328328
329+ copyMacAppWithVersion :
330+ name : Copy Mac .app Files With Version
331+ needs : [ create-release, build-tauri, build-linux-bins ]
332+ runs-on : ubuntu-22.04
333+ permissions :
334+ contents : write
335+ steps :
336+ - uses : actions/checkout@v4
337+
338+ # Recompute or ensure we have PACKAGE_VERSION and GIT_TAG_NAME in the env
339+ - name : get version
340+ run : |
341+ echo "PACKAGE_VERSION=$(node -p \"require('./package.json').version\")" >> $GITHUB_ENV
342+ echo "GIT_TAG_NAME=prod-app-v$(node -p \"require('./package.json').version\")" >> $GITHUB_ENV
343+
344+ #
345+ # 1) Download the x64 .app.tar.gz from the existing draft release
346+ #
347+ - name : Download x64 Mac asset
348+ id : download_x64
349+ uses : actions/github-script@v7
350+ with :
351+ script : |
352+ const fs = require("fs");
353+ const { data: release } = await github.rest.repos.getRelease({
354+ owner: context.repo.owner,
355+ repo: context.repo.repo,
356+ release_id: parseInt("${{ needs.create-release.outputs.release_id }}", 10)
357+ });
358+ const asset = release.assets.find(a => a.name === "Phoenix.Code.Experimental.Build_x64.app.tar.gz");
359+ if (!asset) {
360+ core.setFailed("Could not find 'Phoenix.Code.Experimental.Build_x64.app.tar.gz' in draft release assets.");
361+ return;
362+ }
363+ // Download the asset
364+ const download = await github.rest.repos.getReleaseAsset({
365+ owner: context.repo.owner,
366+ repo: context.repo.repo,
367+ asset_id: asset.id,
368+ headers: {
369+ accept: "application/octet-stream"
370+ }
371+ });
372+ fs.writeFileSync("Phoenix.Code.Experimental.Build_x64.app.tar.gz", Buffer.from(download.data));
373+
374+ #
375+ # 2) Download the aarch64 .app.tar.gz from the existing draft release
376+ #
377+ - name : Download aarch64 Mac asset
378+ id : download_aarch64
379+ uses : actions/github-script@v7
380+ with :
381+ script : |
382+ const fs = require("fs");
383+ const { data: release } = await github.rest.repos.getRelease({
384+ owner: context.repo.owner,
385+ repo: context.repo.repo,
386+ release_id: parseInt("${{ needs.create-release.outputs.release_id }}", 10)
387+ });
388+ const asset = release.assets.find(a => a.name === "Phoenix.Code.Experimental.Build_aarch64.app.tar.gz");
389+ if (!asset) {
390+ core.setFailed("Could not find 'Phoenix.Code.Experimental.Build_aarch64.app.tar.gz' in draft release assets.");
391+ return;
392+ }
393+ // Download the asset
394+ const download = await github.rest.repos.getReleaseAsset({
395+ owner: context.repo.owner,
396+ repo: context.repo.repo,
397+ asset_id: asset.id,
398+ headers: {
399+ accept: "application/octet-stream"
400+ }
401+ });
402+ fs.writeFileSync("Phoenix.Code.Experimental.Build_aarch64.app.tar.gz", Buffer.from(download.data));
403+
404+ #
405+ # 3) Rename each asset with the version appended
406+ #
407+ - name : Rename Mac assets to include version
408+ run : |
409+ echo "Renaming x64 Mac app..."
410+ mv Phoenix.Code.Experimental.Build_x64.app.tar.gz "Phoenix.Code.Experimental.Build_x64_${PACKAGE_VERSION}_intel.app.tar.gz"
411+
412+ echo "Renaming aarch64 Mac app..."
413+ mv Phoenix.Code.Experimental.Build_aarch64.app.tar.gz "Phoenix.Code.Experimental.Build_aarch64_${PACKAGE_VERSION}_M1.app.tar.gz"
414+
415+ echo "Final check of renamed files:"
416+ ls -lh
417+
418+ #
419+ # 4) Re-upload them to the draft release with new filenames. This is needed for download from web workflows
420+ #
421+ - name : Upload renamed Mac app tarballs to draft release
422+ uses : softprops/action-gh-release@v2
423+ with :
424+ release_id : ${{ needs.create-release.outputs.release_id }}
425+ draft : true
426+ tag_name : ${{ env.GIT_TAG_NAME }}
427+ files : |
428+ Phoenix.Code.Experimental.Build_x64_${{ env.PACKAGE_VERSION }}_intel.app.tar.gz
429+ Phoenix.Code.Experimental.Build_aarch64_${{ env.PACKAGE_VERSION }}_M1.app.tar.gz
430+ env :
431+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
432+
329433 publish-release :
330434 permissions :
331435 contents : write
0 commit comments