Files
Sparkle/Configurations/set-git-version-info.sh
Tony Arnold ee679586cf Add a workflow that builds and publishes a release via GitHub Actions (#1908)
The workflow assumes changelog and version information have been updated and the tag has not been created yet before running it. When the workflow finishes, it should take you to a release page with the uploaded binaries, where you can verify the final details and publish a tag officially.

Also the following improvements were made:

* Change CURRENT_PROJECT_VERSION to represent a monotonically increasing bundle version (starting at 2000)
* Add MARKETING_VERSION to represent marketing version of Sparkle, comprised of SPARKLE_VERSION_MAJOR, SPARKLE_VERSION_MINOR, SPARKLE_VERSION_PATCH, and the new SPARKLE_VERSION_SUFFIX for pre-releases.
* Verify code signing signatures of extracted SPM zip file in make release and CI
* Generate changes to Sparkle podspec, just like the Package.swift file, based on current marketing version
* Improve format of Info.plist version strings when appending git hash info, eliminating unnecessary whitespace
* Simplify validating that XPC Service versions align with framework version
* Handle lightweight tags in addition to annotated tags in release-move-tag.sh
2021-08-26 22:42:38 -07:00

41 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
set -e
if ! which -s git ; then
exit 0
fi
if [ -z "$SRCROOT" ] || \
[ -z "$BUILT_PRODUCTS_DIR" ] || \
[ -z "$INFOPLIST_PATH" ] || \
[ -z "$MARKETING_VERSION" ]; then
echo "$0: Must be run from Xcode!" 1>&2
exit 1
fi
version="$MARKETING_VERSION"
# Get version in format 1.x.x-commits-hash
gitversion=$( cd "$SRCROOT"; git describe --tags --match '[12].*' || true )
if [ -z "$gitversion" ] ; then
echo "$0: Can't find a Git hash!" 1>&2
exit 0
fi
# remove everything before the second last "-" to keep the hash part only
versionsuffix=$( echo "${gitversion}" | sed -E 's/.+((-[^.]+){2})$/\1/' )
if [ "$versionsuffix" != "$gitversion" ]; then
version="$version$versionsuffix"
fi
# and use it to set the CFBundleShortVersionString value
export PATH="$PATH:/usr/libexec"
if [ -f "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" ] ; then
oldversion=$(PlistBuddy -c "Print :CFBundleShortVersionString" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH")
fi
if [ "$version" != "$oldversion" ] ; then
PlistBuddy -c "Set :CFBundleShortVersionString '$version'" \
"$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
fi