mas/script/version
Ross Goldberg 3eaffa5c3e
Improve DocC.
Partial #592

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
2024-10-23 06:17:43 -04:00

29 lines
614 B
Bash
Executable file

#!/bin/bash -eu
#
# script/version
# mas
#
# Displays the current marketing version of mas.
#
# 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
echo "${VERSION}"