mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
401c82b28d
The MAS_VERSION env var isn't made available to the pre_release step
59 lines
1.1 KiB
Bash
Executable file
59 lines
1.1 KiB
Bash
Executable file
#!/bin/bash -ex
|
|
#
|
|
# script/brew_core_update
|
|
# mas
|
|
#
|
|
# Updates mas Homebrew core formula:
|
|
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/m/mas.rb
|
|
#
|
|
# brew bump-formula-pr --help
|
|
#
|
|
|
|
mas_dir="$(readlink -fn "$(dirname "${BASH_SOURCE:-"${0}"}")/..")"
|
|
|
|
if ! cd -- "${mas_dir}"; then
|
|
printf $'Error: Could not cd into mas directory: %s\n' "${mas_dir}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
function usage {
|
|
echo 'Usage: brew_core_update [-d]' >&2
|
|
echo ' -d option enables dry run mode' >&2
|
|
exit 1
|
|
}
|
|
|
|
# Max 1 argument
|
|
if [[ "${#}" -gt 1 ]]; then
|
|
usage
|
|
fi
|
|
|
|
dry_run=
|
|
|
|
# Detect presence of `-d` dry run option
|
|
while getopts 'd' o; do
|
|
case "${o}" in
|
|
d)
|
|
dry_run=--dry-run
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
shift "$((OPTIND - 1))"
|
|
|
|
version_tag="v$(script/version)"
|
|
revision="$(git rev-parse "${version_tag}")"
|
|
|
|
echo "==> 🧪 Updating mas homebrew-core formula to version tag ${version_tag} @ revision ${revision}"
|
|
|
|
brew bump-formula-pr \
|
|
--tag "${version_tag}" \
|
|
--revision "${revision}" \
|
|
--fork-org mas-cli \
|
|
--no-browse \
|
|
--online \
|
|
--strict \
|
|
--verbose \
|
|
${dry_run} \
|
|
mas
|