From d583e749519d78fe9f11b478d4fa769560df08cb Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 20 Dec 2018 18:59:38 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9C=20Make=20version=20dynamic=20in=20?= =?UTF-8?q?package=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also call install script instead of separate xcodebuild install command Fixes #179 --- script/build | 5 +++-- script/package | 26 ++++++++++++++++---------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/script/build b/script/build index acd9cdf..ec16aec 100755 --- a/script/build +++ b/script/build @@ -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" \ diff --git a/script/package b/script/package index 6881f8a..5822ac6 100755 --- a/script/package +++ b/script/package @@ -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.