Skip to content

Commit

Permalink
Improve script/package:
Browse files Browse the repository at this point in the history
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 mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
  • Loading branch information
rgoldberg committed Dec 20, 2024
1 parent d5f9dba commit 8994505
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ 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
- name: 📝 Create draft release
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: |
Expand Down
23 changes: 8 additions & 15 deletions script/package
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 8994505

Please sign in to comment.