From 03fb6d969f4a938ed7ee3d773719a63139c51408 Mon Sep 17 00:00:00 2001 From: Jonas Zaugg Date: Tue, 5 Jan 2021 15:37:21 +0100 Subject: [PATCH] Match changes made to 1.x branch Fixes the issue of Package.swift being updated after tag, see #1710. --- Configurations/release-move-tag.sh | 26 ++++++++++++++++++++++++++ Makefile | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 Configurations/release-move-tag.sh diff --git a/Configurations/release-move-tag.sh b/Configurations/release-move-tag.sh new file mode 100755 index 00000000..29c7b681 --- /dev/null +++ b/Configurations/release-move-tag.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +# Convenience script to automatically commit Package.swift after updating the checksum and move the latest tag +latest_git_tag=$(git describe --abbrev=0) # gets the latest tag name +commits_since_tag=$(git rev-list ${latest_git_tag}.. --count) +if [ "$commits_since_tag" -gt 0 ]; then + # If there have been commits since the latest tag, it's highly likely that we did not intend to do a full release + echo "WARNING: $commits_since_tag commit(s) since tag '$latest_git_tag'. Did you tag a new version?" + echo "Package.swift has not been committed and tag has not been moved." +else + # TODO: add sanity check to see if version is actually being updated or not? + read -p "Do you want to commit changes to Package.swift and force move tag '$latest_git_tag'? (required for Swift Package Manager release) " -n 1 -r + echo # (optional) move to a new line + if [[ $REPLY =~ ^[Yy]$ ]]; then + long_message=$(git tag -n99 -l $latest_git_tag) # gets corresponding message + long_message=${long_message/$latest_git_tag} # trims tag name + long_message="$(echo -e "${long_message}" | sed -e 's/^[[:space:]]*//')" # trim leading whitespace + git add Package.swift + git commit -m "Update Package.swift" + git tag -fa $latest_git_tag -m "${long_message}" + echo "Package.swift committed and tag '$latest_git_tag' moved." + else + echo "Package.swift has not been committed and tag has not been moved." + fi +fi diff --git a/Makefile b/Makefile index 3be62e3e..6c35fa7d 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,11 @@ localizable-strings: release: xcodebuild -scheme Distribution -configuration Release -derivedDataPath "$(BUILDDIR)" build + ./Configurations/release-move-tag.sh open "$(BUILDDIR)/Build/Products/Release/" cat Sparkle.podspec @echo "Don't forget to update CocoaPods! pod trunk push" - @echo "Don't forget to commit the updated Package manifest before releasing!" + @echo "Don't forget to upload Sparkle-for-Swift-Package-Manager.zip!" build: xcodebuild clean build