From 873a02662754cf4e7fd54270c334736968d67950 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 30 Oct 2021 22:55:27 -0700 Subject: [PATCH] Add project version inputs to create-draft-release workflow (#1998) --- .github/workflows/create-draft-release.yml | 45 +++++++++++++++++----- Configurations/ConfigCommon.xcconfig | 2 + Sparkle.xcodeproj/project.pbxproj | 2 + 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create-draft-release.yml b/.github/workflows/create-draft-release.yml index 1fa8f6e7..0d7ac1cb 100644 --- a/.github/workflows/create-draft-release.yml +++ b/.github/workflows/create-draft-release.yml @@ -5,7 +5,22 @@ env: DEVELOPER_DIR: "/Applications/Xcode_13.1.app/Contents/Developer" on: - workflow_dispatch + workflow_dispatch: + inputs: + marketingVersion: + description: "Marketing Version" + required: true + default: "" + + prereleaseSuffix: + description: "Pre-release Suffix" + required: false + default: "" + + buildVersion: + description: "Product Build" + required: true + default: "" concurrency: group: publish-release-${{ github.ref }} @@ -27,16 +42,26 @@ jobs: - name: "Extract latest changes from CHANGELOG" run: | ./Configurations/generate_latest_changes.py > latest-changes.txt - - - name: "Extract version information from project" + + - name: "Overwrite project versions in project" run: | - MARKETING_VERSION=$(xcrun xcodebuild -showBuildSettings -project Sparkle.xcodeproj | grep -m 1 '^[[:space:]]*MARKETING_VERSION' | sed -E 's/.+=[[:space:]]+(.*)$/\1/') - echo "MARKETING_VERSION=${MARKETING_VERSION}" >> $GITHUB_ENV + IFS='.' read major minor patch <<< "${{ github.event.inputs.marketingVersion }}" + sed -E -i '' "s/SPARKLE_VERSION_MAJOR =.+/SPARKLE_VERSION_MAJOR = $major/g" ./Configurations/ConfigCommon.xcconfig + sed -E -i '' "s/SPARKLE_VERSION_MINOR =.+/SPARKLE_VERSION_MINOR = $minor/g" ./Configurations/ConfigCommon.xcconfig + sed -E -i '' "s/SPARKLE_VERSION_PATCH =.+/SPARKLE_VERSION_PATCH = $patch/g" ./Configurations/ConfigCommon.xcconfig + + if [[ ! -z "${{ github.event.inputs.prereleaseSuffix }}" ]]; then + sed -E -i '' "s/SPARKLE_VERSION_SUFFIX =.*/SPARKLE_VERSION_SUFFIX = ${{ github.event.inputs.prereleaseSuffix }}/g" ./Configurations/ConfigCommon.xcconfig + else + sed -E -i '' "s/SPARKLE_VERSION_SUFFIX =.*/SPARKLE_VERSION_SUFFIX =/g" ./Configurations/ConfigCommon.xcconfig + fi + + sed -E -i '' "s/CURRENT_PROJECT_VERSION =.+/CURRENT_PROJECT_VERSION = ${{ github.event.inputs.buildVersion }}/g" ./Configurations/ConfigCommon.xcconfig + git add ./Configurations/ConfigCommon.xcconfig - name: "Determine if this is a pre-release version" run: | - SPARKLE_VERSION_SUFFIX=$(xcrun xcodebuild -showBuildSettings -project Sparkle.xcodeproj | grep -m 1 '^[[:space:]]*SPARKLE_VERSION_SUFFIX' | sed -E 's/.+=[[:space:]]+(.*)$/\1/') - if [[ ! -z "$SPARKLE_VERSION_SUFFIX" ]]; then + if [[ ! -z "${{ github.event.inputs.prereleaseSuffix }}" ]]; then echo "PRERELEASE_VERSION=true" >> $GITHUB_ENV else echo "PRERELEASE_VERSION=false" >> $GITHUB_ENV @@ -46,7 +71,7 @@ jobs: run: | git config user.name Sparkle-Bot git config user.email sparkle.project.bot@gmail.com - git tag "${{ env.MARKETING_VERSION }}" + git tag "${{ github.event.inputs.marketingVersion }}" - name: "Build release distribution" run: make release @@ -65,8 +90,8 @@ jobs: with: draft: true prerelease: ${{ env.PRERELEASE_VERSION }} - name: "Sparkle ${{ env.MARKETING_VERSION }}" - tag_name: ${{ env.MARKETING_VERSION }} + name: "Sparkle ${{ github.event.inputs.marketingVersion }}" + tag_name: ${{ github.event.inputs.marketingVersion }} fail_on_unmatched_files: true token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }} body_path: latest-changes.txt diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index e96d57d8..d4e46986 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -32,11 +32,13 @@ SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0 SPARKLE_ICON_NAME = AppIcon // If you change any of these version details, you must increase CURRENT_PROJECT_VERSION +// These variables must have a space after the '=' too SPARKLE_VERSION_MAJOR = 2 SPARKLE_VERSION_MINOR = 0 SPARKLE_VERSION_PATCH = 0 // This should be in SemVer format or empty, ie. "-beta.1" +// These variables must have a space after the '=' too SPARKLE_VERSION_SUFFIX = -beta.4 CURRENT_PROJECT_VERSION = 2004 diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index a8e69086..bdcbad68 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -1120,6 +1120,7 @@ 724BB3B51D35AAC3005D534A /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; }; 725602D31C83551C00DAA70E /* SUApplicationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUApplicationInfo.h; sourceTree = ""; }; 725602D41C83551C00DAA70E /* SUApplicationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUApplicationInfo.m; sourceTree = ""; }; + 72563CA9272E1C5400AF39F0 /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = ""; }; 725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_minimumAutoupdateVersion.xml; sourceTree = ""; }; 725CB9561C7120410064365A /* SPUUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUUserDriver.h; sourceTree = ""; }; 725CB9581C7121830064365A /* SPUStandardUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUStandardUserDriver.h; sourceTree = ""; }; @@ -1562,6 +1563,7 @@ 14732BB51960ECBA00593899 /* Vendor */, 1420DE391962322200203BB0 /* Documentation */, FA1941C40D94A6EA00DD942E /* Configurations */, + 72563CA9272E1C5400AF39F0 /* .github */, 726B2B5E1C645FC900388755 /* UI Tests */, 0867D69AFE84028FC02AAC07 /* Frameworks */, 034768DFFF38A50411DB9C8B /* Products */,