mas/script/version
Ben Chatelain f7152f211d 🥅 Handle version script errors when invoked by act
| fatal: Not a valid object name HEAD
| MAS_VERSION: 0.0.0
2024-02-18 14:05:02 -07:00

27 lines
600 B
Bash
Executable file

#!/bin/bash -e
#
# 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
if git describe 2>/dev/null; then
MAS_VERSION=$(git describe --abbrev=0 --tags 2>/dev/null || true)
else
MAS_VERSION=0.0.0
fi
MAS_VERSION=${MAS_VERSION#v}
echo "MAS_VERSION: ${MAS_VERSION}"
SCRIPT_PATH=$(dirname "$(which "$0")")
cat <<EOF >"${SCRIPT_PATH}/../Sources/MasKit/Package.swift"
// Generated by: script/version
enum Package {
static let version = "${MAS_VERSION}"
}
EOF