From 8994505feca735bb7d266342e17fa173074d3343 Mon Sep 17 00:00:00 2001 From: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:53:19 -0500 Subject: [PATCH] Improve `script/package`: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename `mas.pkg` as `mas-${version}.pkg`. Use `/usr/local/bin` for `--install-location` instead of having executable stored in `.pkg` under `mas_components.pkg/Payload/usr/local/bin`. Do not output SHA-256 of `.pkg`. Move `script/build …` earlier. Rename variables & temporary folders to follow Apple's terminology. Update comments. Partial #638 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> --- .github/workflows/release.yml | 6 +++--- script/package | 23 ++++++++--------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bf993424..c6d12a23 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,7 @@ jobs: run: | script/bootstrap - - name: 📦 Build universal executable & package it in mas.pkg + - name: 📦 Build universal executable & package it in an installer run: | script/package @@ -58,9 +58,9 @@ jobs: run: | gh release create -d --generate-notes ${PRERELEASE} "${TAG_NAME}" - - name: 📤 Upload mas.pkg + - name: 📤 Upload installer run: | - gh release upload "${TAG_NAME}" .build/mas.pkg + gh release upload "${TAG_NAME}" ".build/mas-${TAG_NAME#v}.pkg" - name: 🚰 Bump mas-cli/tap/mas formula run: | diff --git a/script/package b/script/package index aac67584..93a34252 100755 --- a/script/package +++ b/script/package @@ -3,36 +3,29 @@ # script/package # mas # -# Builds macOS installer component and distribution packages. +# Builds .pkg installer. # . "${0:a:h}/_setup_script" +script/build --arch arm64 --arch x86_64 + build_dir=.build -distribution_package="${build_dir}/mas.pkg" -distributions_root="${build_dir}/distributions" +destination_root="${build_dir}/destination" version="$(script/version)" -script/build --arch arm64 --arch x86_64 - printf $'==> 📦 Assembling installer package for mas %s\n' "${version}" -ditto -v "${build_dir}/apple/Products/Release/mas" "${distributions_root}/usr/local/bin/mas" +ditto -v "${build_dir}/apple/Products/Release/mas" "${destination_root}/mas" -# Assemble macOS installer component package (aka product archive). pkgbuild \ --identifier com.mphys.mas-cli \ - --install-location / \ + --install-location /usr/local/bin \ --version "${version}" \ - --root "${distributions_root}" \ + --root "${destination_root}" \ "${build_dir}/mas_components.pkg" -# Build distribution package (aka product archive). Not sure why, but this is how Carthage does it. -# https://github.com/Carthage/Carthage/blob/master/Makefile#L69 productbuild \ --distribution Package/Distribution.plist \ --package-path "${build_dir}" \ - "${distribution_package}" - -printf $'==> 🔢 File Hash\n' -shasum -a 256 "${distribution_package}" + "${build_dir}/mas-${version}.pkg"