mirror of
https://github.com/mas-cli/mas
synced 2024-11-21 19:23:01 +00:00
Simplify & standardize script output headers & mas version handling.
Partial #638 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
d2fabf65fa
commit
36d40d99d7
9 changed files with 16 additions and 24 deletions
|
@ -31,7 +31,7 @@ while getopts 'f' opt; do
|
|||
esac
|
||||
done
|
||||
|
||||
printf $'==> 👢 Bootstrapping (%s)\n' "$(script/version)"
|
||||
printf $'==> 👢 Bootstrapping mas %s\n' "$(script/version)"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
brew bundle install ${frozen} --verbose
|
||||
|
|
|
@ -23,8 +23,8 @@ fi
|
|||
|
||||
BOTTLE_DIR=".build/bottles"
|
||||
CORE_TAP_PATH="$(brew --repo homebrew/core)"
|
||||
MAS_VERSION="$(script/version)"
|
||||
ROOT_URL="https://github.com/mas-cli/mas/releases/download/v${MAS_VERSION}"
|
||||
version="$(script/version)"
|
||||
ROOT_URL="https://github.com/mas-cli/mas/releases/download/v${version}"
|
||||
|
||||
# Supports macOS 10.13 and later
|
||||
OS_NAMES=(
|
||||
|
@ -76,8 +76,6 @@ if [[ "$(uname -m)" == 'arm64' ]]; then
|
|||
CURRENT_PLATFORM="arm64_${CURRENT_PLATFORM}"
|
||||
fi
|
||||
|
||||
echo "CURRENT_PLATFORM: ${CURRENT_PLATFORM}"
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Preflight checks
|
||||
|
@ -105,14 +103,14 @@ brew style Homebrew/mas-tap.rb
|
|||
# Build the formula for the current macOS version and architecture.
|
||||
#
|
||||
|
||||
echo "==> 🍼 Bottling mas ${MAS_VERSION} for: ${OS_NAMES[*]}"
|
||||
echo "==> 🍼 Bottling mas ${version} on ${CURRENT_PLATFORM} for ${OS_NAMES[*]}"
|
||||
brew install --build-bottle mas-cli/tap/mas
|
||||
|
||||
# Generate bottle do block, dropping last 2 lines
|
||||
brew bottle --verbose --no-rebuild --root-url="${ROOT_URL}" mas-cli/tap/mas
|
||||
|
||||
# Output filename from brew bottle
|
||||
generated_bottle_filename="mas--${MAS_VERSION}.${CURRENT_PLATFORM}.bottle.tar.gz"
|
||||
generated_bottle_filename="mas--${version}.${CURRENT_PLATFORM}.bottle.tar.gz"
|
||||
|
||||
if [[ ! -e "${generated_bottle_filename}" ]]; then
|
||||
echo "Bottle not found: ${generated_bottle_filename}" >&2
|
||||
|
@ -140,7 +138,7 @@ EOF
|
|||
|
||||
# Fix filename
|
||||
for os in "${OS_NAMES[@]}"; do
|
||||
cp -v "${generated_bottle_filename}" "${BOTTLE_DIR}/mas-${MAS_VERSION}.${os}.bottle.tar.gz"
|
||||
cp -v "${generated_bottle_filename}" "${BOTTLE_DIR}/mas-${version}.${os}.bottle.tar.gz"
|
||||
|
||||
# Append each os
|
||||
# BOTTLE_BLOCK="$(printf "${BOTTLE_BLOCK}\n sha256 cellar: :any_skip_relocation, %-15s %s" "${os}:" "${SHA256}")"
|
||||
|
|
|
@ -30,7 +30,7 @@ else
|
|||
CACHE=()
|
||||
fi
|
||||
|
||||
echo "==> 🏗️ Building mas ($(script/version --write))"
|
||||
echo "==> 🏗️ Building mas $(script/version --write)"
|
||||
swift build \
|
||||
--configuration release \
|
||||
"${ARCH[@]+"${ARCH[@]}"}" \
|
||||
|
|
|
@ -13,9 +13,7 @@ if ! cd -- "${mas_dir}"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
MAS_VERSION="$(script/version)"
|
||||
|
||||
echo "Building mas ${MAS_VERSION} artifacts"
|
||||
echo "==> 👑 Building mas $(script/version) artifacts"
|
||||
|
||||
script/clean
|
||||
script/build --universal
|
||||
|
|
|
@ -19,7 +19,6 @@ fi
|
|||
|
||||
ARCH="$(uname -m)"
|
||||
RELEASE=".build/${ARCH}-apple-macosx/release"
|
||||
MAS_VERSION="$(script/version)"
|
||||
PREFIX=/usr/local
|
||||
|
||||
while [[ -n "${1}" ]]; do
|
||||
|
@ -34,7 +33,7 @@ while [[ -n "${1}" ]]; do
|
|||
shift
|
||||
done
|
||||
|
||||
echo "==> 📲 Installing mas (${MAS_VERSION}) for ${ARCH} to ${PREFIX}"
|
||||
echo "==> 📲 Installing mas $(script/version) for ${ARCH} to ${PREFIX}"
|
||||
ditto -v \
|
||||
"${RELEASE}/mas" \
|
||||
"${PREFIX}/bin/mas"
|
||||
|
|
|
@ -19,7 +19,7 @@ if ! cd -- "${mas_dir}"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
printf $'==> 🚨 Linting mas (%s)\n' "$(script/version --write)"
|
||||
printf $'==> 🚨 Linting mas %s\n' "$(script/version --write)"
|
||||
|
||||
for linter in git markdownlint periphery shellcheck shfmt swift-format swiftformat swiftlint yamllint; do
|
||||
if [[ ! -x "$(command -v "${linter}")" ]]; then
|
||||
|
|
|
@ -27,15 +27,15 @@ DISTRIBUTION_PLIST=Package/Distribution.plist
|
|||
DSTROOT="${BUILD_DIR}/distributions"
|
||||
script/install "${DSTROOT}/usr/local" --universal
|
||||
|
||||
MAS_VERSION="$(script/version)"
|
||||
version="$(script/version)"
|
||||
|
||||
echo '==> 📦 Assemble an installer package'
|
||||
echo "==> 📦 Assembling installer package for mas ${version}"
|
||||
|
||||
# Assemble macOS installer component package (aka 'product archive').
|
||||
pkgbuild \
|
||||
--identifier "${IDENTIFIER}" \
|
||||
--install-location '/' \
|
||||
--version "${MAS_VERSION}" \
|
||||
--version "${version}" \
|
||||
--root "${DSTROOT}" \
|
||||
"${COMPONENT_PACKAGE}"
|
||||
|
||||
|
|
|
@ -13,6 +13,6 @@ if ! cd -- "${mas_dir}"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
printf $'==> ✅ Testing mas (%s)\n' "$(script/version --write)"
|
||||
printf $'==> ✅ Testing mas %s\n' "$(script/version --write)"
|
||||
|
||||
swift test
|
||||
|
|
|
@ -13,11 +13,8 @@ if ! cd -- "${mas_dir}"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${MAS_VERSION:-}" ]] && git describe >/dev/null 2>&1; then
|
||||
# Use last tag if MAS_VERSION environment variable is unset or empty
|
||||
MAS_VERSION="$(git describe --abbrev=0 --tags 2>/dev/null || true)"
|
||||
fi
|
||||
echo "${MAS_VERSION#v}"
|
||||
version_tag="$(git describe --abbrev=0 --tags 2>/dev/null)"
|
||||
printf $'%s\n' "${version_tag#v}"
|
||||
|
||||
if [[ "${#}" -ge 1 && "${1}" == '--write' ]]; then
|
||||
# Write new version into swift package
|
||||
|
|
Loading…
Reference in a new issue