Skip to content

Commit 34a6b8f

Browse files
Enhance Info.plist updates and AboutView debugging
🔧 Info.plist Updates: - Added debug logging to display current and updated Info.plist content during version updates. - Updated CFBundleShortVersionString, CFBundleVersion, and GitHash with clearer logging messages. 📱 AboutView Improvements: - Enhanced version and build number detection logic to differentiate between local and GitHub Actions builds. - Added debug prints for better visibility of version and git hash processing. This improves the clarity of version updates and enhances the user experience by providing more informative logs during the build process.
1 parent 7517087 commit 34a6b8f

3 files changed

Lines changed: 34 additions & 11 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,26 @@ jobs:
6464
# Update the source Info.plist before building
6565
INFO_PLIST="A6Cutter/Info.plist"
6666
67+
# Debug: Show current Info.plist content
68+
echo "📄 Current Info.plist content:"
69+
plutil -p "$INFO_PLIST" | grep -E "(CFBundleShortVersionString|CFBundleVersion|GitHash)" || echo "No version info found"
70+
6771
# Update version and build number
72+
echo "🔧 Updating CFBundleShortVersionString to: ${{ steps.version_info.outputs.VERSION }}"
6873
plutil -replace CFBundleShortVersionString -string "${{ steps.version_info.outputs.VERSION }}" "$INFO_PLIST"
74+
75+
echo "🔧 Updating CFBundleVersion to: ${{ github.run_number }}"
6976
plutil -replace CFBundleVersion -string "${{ github.run_number }}" "$INFO_PLIST"
7077
7178
# Add git hash to Info.plist
79+
echo "🔧 Updating GitHash to: ${{ steps.version_info.outputs.GIT_HASH }}"
7280
plutil -replace GitHash -string "${{ steps.version_info.outputs.GIT_HASH }}" "$INFO_PLIST"
7381
74-
echo "Updated Info.plist with version ${{ steps.version_info.outputs.VERSION }} and hash ${{ steps.version_info.outputs.GIT_HASH_SHORT }}"
82+
# Debug: Show updated Info.plist content
83+
echo "📄 Updated Info.plist content:"
84+
plutil -p "$INFO_PLIST" | grep -E "(CFBundleShortVersionString|CFBundleVersion|GitHash)"
85+
86+
echo "✅ Updated Info.plist with version ${{ steps.version_info.outputs.VERSION }} and hash ${{ steps.version_info.outputs.GIT_HASH_SHORT }}"
7587
7688
- name: Download Sparkle tools
7789
run: |

A6Cutter/AboutView.swift

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,41 @@ struct AboutView: View {
7373
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
7474
// Remove 'v' prefix if present for consistent display
7575
let cleanVersion = version.hasPrefix("v") ? String(version.dropFirst()) : version
76+
print("DEBUG AboutView: CFBundleShortVersionString = '\(version)' -> cleanVersion = '\(cleanVersion)'")
7677
return cleanVersion
7778
}
79+
print("DEBUG AboutView: CFBundleShortVersionString not found")
7880
return "Deve"
7981
}
8082

8183
private var buildNumber: String {
8284
if let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String {
83-
// For local builds, CFBundleVersion is git commit hash (7 chars)
84-
// For GitHub Actions builds, it's a build number
85-
// Check if it looks like a git hash (7 chars, alphanumeric)
86-
if build.count == 7 && build.allSatisfy({ $0.isLetter || $0.isNumber }) {
87-
return build // Local build - git hash
88-
} else {
89-
return build // GitHub Actions build - build number
85+
// Check if this is a local build by looking at CFBundleShortVersionString
86+
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
87+
print("DEBUG AboutView: CFBundleVersion = '\(build)', version contains -dev: \(version.contains("-dev"))")
88+
if version.contains("-dev") {
89+
// Local build - CFBundleVersion is git commit hash
90+
print("DEBUG AboutView: Local build detected, returning git hash: '\(build)'")
91+
return build
92+
} else {
93+
// GitHub Actions build - CFBundleVersion is build number
94+
print("DEBUG AboutView: GitHub Actions build detected, returning build number: '\(build)'")
95+
return build
96+
}
9097
}
9198
}
99+
print("DEBUG AboutView: CFBundleVersion not found")
92100
return "dev"
93101
}
94102

95103
private var gitHash: String {
96104
if let hash = Bundle.main.infoDictionary?["GitHash"] as? String {
97105
// Show first 7 characters of git hash for readability
98-
return String(hash.prefix(7))
106+
let shortHash = String(hash.prefix(7))
107+
print("DEBUG AboutView: GitHash = '\(hash)' -> shortHash = '\(shortHash)'")
108+
return shortHash
99109
}
110+
print("DEBUG AboutView: GitHash not found")
100111
return "dev"
101112
}
102113

A6Cutter/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundleSignature</key>
1818
<string>????</string>
1919
<key>CFBundleVersion</key>
20-
<string>8e348e2</string>
20+
<string>7517087</string>
2121
<key>GitHash</key>
22-
<string>8e348e2abcf8fc736e788e862162fd00c41a5dd7</string>
22+
<string>7517087bd06bf95e03539d5e7ddcfe3bb2ccd4ec</string>
2323
<key>LSMinimumSystemVersion</key>
2424
<string>14.0</string>
2525
<key>NSHumanReadableCopyright</key>

0 commit comments

Comments
 (0)