From 0ca9d34f429a1617305c27886aa05c4c6d913476 Mon Sep 17 00:00:00 2001 From: Jonas Zaugg Date: Mon, 4 Jan 2021 11:24:26 +0100 Subject: [PATCH 1/5] [WIP] Fix catch-22 Swift Package Manager binary target Should fix #1674, currently WIP --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 3be62e3e..c59b5820 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ localizable-strings: release: xcodebuild -scheme Distribution -configuration Release -derivedDataPath "$(BUILDDIR)" build + git tag -fa open "$(BUILDDIR)/Build/Products/Release/" cat Sparkle.podspec @echo "Don't forget to update CocoaPods! pod trunk push" From 2e048a86010075e7bbc80313e6b76122e472744a Mon Sep 17 00:00:00 2001 From: Jonas Zaugg Date: Tue, 5 Jan 2021 12:19:14 +0100 Subject: [PATCH 2/5] Add script to commit and re-tag changes to Package.swift --- Configurations/release-move-tag.sh | 16 ++++++++++++++++ Makefile | 2 +- 2 files changed, 17 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..a97f7eda --- /dev/null +++ b/Configurations/release-move-tag.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +# Finishing up - force re-tag +latest_git_tag=$(git describe --abbrev=0) # gets the latest tag name +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}" +fi diff --git a/Makefile b/Makefile index c59b5820..28fbe1c8 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ localizable-strings: release: xcodebuild -scheme Distribution -configuration Release -derivedDataPath "$(BUILDDIR)" build - git tag -fa + ./Configurations/release-move-tag.sh open "$(BUILDDIR)/Build/Products/Release/" cat Sparkle.podspec @echo "Don't forget to update CocoaPods! pod trunk push" From d21a303b2e2c6db8472217e2120c9b308576726b Mon Sep 17 00:00:00 2001 From: Jonas Zaugg Date: Tue, 5 Jan 2021 13:07:11 +0100 Subject: [PATCH 3/5] Update release-move-tag.sh Prevents re-tagging when there are more than one commits since latest tag (to prevent accidentally moving an old tag) --- Configurations/release-move-tag.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Configurations/release-move-tag.sh b/Configurations/release-move-tag.sh index a97f7eda..e314386a 100755 --- a/Configurations/release-move-tag.sh +++ b/Configurations/release-move-tag.sh @@ -1,16 +1,23 @@ #!/bin/bash set -e -# Finishing up - force re-tag +# 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 -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}" +commits_since_tag=$(git rev-list ${latest_git_tag}.. --count) +if [ "$commits_since_tag" -ge 1 ]; then + # If there has been more than one commits since the latest tag, it's highly likely that we did not intend to do a full release + echo "WARNING: More than one commit ($commits_since_tag) since tag '$latest_git_tag'. Did you tag a new version?" + echo "Package.swift has not been commited 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}" + fi fi From 1b5e9384231ec2a2127a748d5c50cbd65e30b87c Mon Sep 17 00:00:00 2001 From: Jonas Zaugg Date: Tue, 5 Jan 2021 13:17:05 +0100 Subject: [PATCH 4/5] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 28fbe1c8..6c35fa7d 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ release: 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 From 602ac871b854416d7e64f6cd182a77e30c10c31e Mon Sep 17 00:00:00 2001 From: Jonas Zaugg Date: Tue, 5 Jan 2021 14:42:40 +0100 Subject: [PATCH 5/5] Update release-move-tag.sh Fixes commit counting logic, some typos and logs more info. --- Configurations/release-move-tag.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Configurations/release-move-tag.sh b/Configurations/release-move-tag.sh index e314386a..29c7b681 100755 --- a/Configurations/release-move-tag.sh +++ b/Configurations/release-move-tag.sh @@ -4,10 +4,10 @@ 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" -ge 1 ]; then - # If there has been more than one commits since the latest tag, it's highly likely that we did not intend to do a full release - echo "WARNING: More than one commit ($commits_since_tag) since tag '$latest_git_tag'. Did you tag a new version?" - echo "Package.swift has not been commited and tag has not been moved." +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 @@ -19,5 +19,8 @@ else 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