📜 Make version dynamic in package script

Also call install script instead of separate xcodebuild install command

Fixes #179
This commit is contained in:
Ben Chatelain 2018-12-20 18:59:38 -07:00
parent 7e3df0345f
commit d583e74951
2 changed files with 19 additions and 12 deletions

View file

@ -4,6 +4,7 @@ BUILD_DIR="$PWD/build"
PROJECT="mas-cli.xcodeproj"
SCHEME="mas-cli Release"
CONFIG="Release"
VERSION=$(agvtool what-marketing-version -terse1)
main() {
script/clean
@ -30,7 +31,7 @@ main() {
# but is set per-project or per-user. By default, this is set to `$(PROJECT_DIR)/build`.
build() {
echo "==> 🏗️ Building"
echo "==> 🏗️ Building mas ($VERSION)"
set -o pipefail && \
xcodebuild -project "$PROJECT" \
-scheme "$SCHEME" \
@ -42,7 +43,7 @@ build() {
}
archive() {
echo "==> 📦 Archiving"
echo "==> 📦 Archiving ($VERSION)"
set -o pipefail && \
xcodebuild -project "$PROJECT" \
-scheme "$SCHEME" \

View file

@ -1,17 +1,23 @@
#!/bin/bash -ex
# TODO: Make VERSION_STRING dynamic
VERSION_STRING=1.4.3
BUILD_DIR="$PWD/build"
INTERNAL_PACKAGE="$BUILD_DIR/mas_temp.pkg"
OUTPUT_PACKAGE="$BUILD_DIR/mas.pkg"
xcodebuild install
IDENTIFIER="com.mphys.mas-cli"
COMPONENTS_PLIST="Homebrew/Components.plist"
DISTRIBUTION_PLIST="Homebrew/Distribution.plist"
# Destination for `xcodebuild install`
# DSTROOT will be updated if unset.
INSTALL_TEMPORARY_FOLDER=${DSTROOT:-build/distributions}
VERSION=$(agvtool what-marketing-version -terse1)
# Run Xcode's install process
script/install
echo "==> 📦 Assemble an installer package"
IDENTIFIER=com.mphys.mas-cli
COMPONENTS_PLIST=Homebrew/Components.plist
DISTRIBUTION_PLIST=Homebrew/Distribution.plist
INSTALL_TEMPORARY_FOLDER=/tmp/mas-cli.dst
INTERNAL_PACKAGE=mas_temp.pkg
OUTPUT_PACKAGE=mas.pkg
# Assemble pkg. Using /usr/local prefix to avoid the following errors with "/"
# - installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)
@ -21,7 +27,7 @@ pkgbuild \
--identifier "$IDENTIFIER" \
--install-location "/usr/local" \
--root "$INSTALL_TEMPORARY_FOLDER" \
--version "$VERSION_STRING" \
--version "$VERSION" \
"$INTERNAL_PACKAGE"
# Build 2nd pkg from 1st. Not sure why, but this is how Carthage does it.