mas/script/version

30 lines
614 B
Text
Raw Normal View History

#!/bin/bash -eu
2019-01-13 07:18:35 +00:00
#
# script/version
# mas
#
# Displays the current marketing version of mas.
2019-01-13 07:18:35 +00:00
#
# This no longer works with MARKETING_VERSION build setting in Info.plist
# agvtool what-marketing-version -terse1
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
VERSION=$(git describe --abbrev=0 --tags)
VERSION=${VERSION#v}
cat <<EOF >"Sources/mas/Package.swift"
/// Generated by \`script/version\`.
enum Package {
static let version = "${VERSION}"
}
EOF
2021-06-09 01:56:27 +00:00
echo "${VERSION}"