🔨 Add version_bump script

Moved swift package manifest manipulation out of version script
This commit is contained in:
Ben Chatelain 2024-03-09 11:23:14 -07:00
parent 80c85f5200
commit 67e678452f
No known key found for this signature in database
2 changed files with 35 additions and 9 deletions

View file

@ -16,12 +16,3 @@ else
fi
MAS_VERSION=${MAS_VERSION#v}
echo "${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

35
script/version_bump Executable file
View file

@ -0,0 +1,35 @@
#!/bin/bash -e
#
# script/version_bump
# mas
#
# Increments the marketing version of mas.
#
last_tag=$(script/version)
echo "Last git tag: $last_tag"
# arg 1 - version tag
if test -n "$1"; then
# auto-increment
MAS_VERSION=$1
else
next_tag=$last_tag
MAS_VERSION=$next_tag
fi
echo "MAS_VERSION: $MAS_VERSION"
# Write new version into swift package
SCRIPT_PATH=$(dirname "$(which "$0")")
PACKAGE_MANIFEST="${SCRIPT_PATH}/../Sources/MasKit/Package.swift"
cat <<EOF >"${PACKAGE_MANIFEST}"
// Generated by: script/version
enum Package {
static let version = "${MAS_VERSION}"
}
EOF
echo
cat "${PACKAGE_MANIFEST}"