diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index d141e0e..407d18c 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -70,12 +70,21 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Building pre-release version: $VERSION" - - name: Update version in project + - name: Determine build identifiers + id: build run: | VERSION=${{ steps.version.outputs.version }} SHORT_SHA=$(git rev-parse --short HEAD) - agvtool new-marketing-version "$VERSION" - agvtool new-version -all "$SHORT_SHA" + echo "marketing_version=$VERSION" >> $GITHUB_OUTPUT + echo "build_number=$VERSION" >> $GITHUB_OUTPUT + echo "git_sha=$SHORT_SHA" >> $GITHUB_OUTPUT + echo "Marketing version: $VERSION" + echo "Build number: $VERSION" + echo "Git SHA: $SHORT_SHA" + + - name: Set git SHA in Info.plist + run: | + /usr/libexec/PlistBuddy -c "Add :GitSHA string ${{ steps.build.outputs.git_sha }}" "BetterCapture/Info.plist" - name: Build application run: | @@ -90,6 +99,8 @@ jobs: CODE_SIGN_IDENTITY="Developer ID Application" \ CODE_SIGN_STYLE=Manual \ OTHER_CODE_SIGN_FLAGS="--timestamp --options=runtime" \ + MARKETING_VERSION="${{ steps.build.outputs.marketing_version }}" \ + CURRENT_PROJECT_VERSION="${{ steps.build.outputs.build_number }}" \ | xcbeautify --renderer github-actions - name: Export application diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b647108..f9b51ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,18 +80,24 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Building version: $VERSION" - - name: Update version in project + - name: Determine build identifiers + id: build run: | VERSION=${{ steps.version.outputs.version }} SHORT_SHA=$(git rev-parse --short HEAD) - agvtool new-marketing-version "$VERSION" - agvtool new-version -all "$SHORT_SHA" - - - name: Set Sparkle public key in Info.plist + echo "marketing_version=$VERSION" >> $GITHUB_OUTPUT + echo "build_number=$VERSION" >> $GITHUB_OUTPUT + echo "git_sha=$SHORT_SHA" >> $GITHUB_OUTPUT + echo "Marketing version: $VERSION" + echo "Build number: $VERSION" + echo "Git SHA: $SHORT_SHA" + + - name: Set Sparkle public key and git SHA in Info.plist env: SPARKLE_PUBLIC_KEY: ${{ secrets.SPARKLE_PUBLIC_EDDSA_KEY }} run: | /usr/libexec/PlistBuddy -c "Set :SUPublicEDKey $SPARKLE_PUBLIC_KEY" "BetterCapture/Info.plist" + /usr/libexec/PlistBuddy -c "Add :GitSHA string ${{ steps.build.outputs.git_sha }}" "BetterCapture/Info.plist" - name: Build application run: | @@ -106,6 +112,8 @@ jobs: CODE_SIGN_IDENTITY="Developer ID Application" \ CODE_SIGN_STYLE=Manual \ OTHER_CODE_SIGN_FLAGS="--timestamp --options=runtime" \ + MARKETING_VERSION="${{ steps.build.outputs.marketing_version }}" \ + CURRENT_PROJECT_VERSION="${{ steps.build.outputs.build_number }}" \ | xcbeautify --renderer github-actions - name: Export application @@ -226,8 +234,10 @@ jobs: || echo "No previous appcast found, will create a fresh one" # Run the appcast generation script + # Note: BUILD_NUMBER uses VERSION for Sparkle comparison (not git SHA) cd "$APPCAST_DIR" VERSION="$VERSION" \ + BUILD_NUMBER="$VERSION" \ DMG_URL="$DMG_URL" \ RELEASE_NOTES="$RELEASE_NOTES" \ RELEASE_URL="$RELEASE_URL" \ diff --git a/BetterCapture/View/SettingsView.swift b/BetterCapture/View/SettingsView.swift index 82e62d8..9700907 100644 --- a/BetterCapture/View/SettingsView.swift +++ b/BetterCapture/View/SettingsView.swift @@ -249,13 +249,13 @@ struct AboutSection: View { Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown" } - private var buildNumber: String { - Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "Unknown" + private var gitSHA: String { + Bundle.main.infoDictionary?["GitSHA"] as? String ?? "dev" } var body: some View { Section("About") { - LabeledContent("Version", value: "\(appVersion) (\(buildNumber))") + LabeledContent("Version", value: "v\(appVersion) (\(gitSHA))") LabeledContent("Website") { Link("jsattler.github.io/BetterCapture", destination: URL(string: "https://jsattler.github.io/BetterCapture")!) diff --git a/dist/update_appcast.py b/dist/update_appcast.py index aa8a7d3..eaa60ee 100644 --- a/dist/update_appcast.py +++ b/dist/update_appcast.py @@ -16,6 +16,7 @@ Required environment variables: - VERSION The version number (e.g. 1.0.0). + - BUILD_NUMBER The build number (typically same as VERSION). - DMG_URL The download URL for the DMG. Optional environment variables: @@ -33,6 +34,7 @@ now = datetime.now(timezone.utc) version = os.environ["VERSION"] +build_number = os.environ["BUILD_NUMBER"] dmg_url = os.environ["DMG_URL"] release_notes = os.environ.get("RELEASE_NOTES", "") release_url = os.environ.get("RELEASE_URL", "") @@ -208,9 +210,8 @@ def markdown_to_simple_html(md: str) -> str: elem.text = now.strftime(pubdate_format) elem = ET.SubElement(item, f"{{{SPARKLE_NS}}}version") -# Use a build number derived from version for CFBundleVersion comparison # Sparkle compares sparkle:version against CFBundleVersion -elem.text = "1" # Will be overridden in CI with the actual build number +elem.text = build_number elem = ET.SubElement(item, f"{{{SPARKLE_NS}}}shortVersionString") elem.text = version