Merge pull request #1124 from mitchellh/macos-build

macos: put build numbers back into info.plist, other metadata
This commit is contained in:
Mitchell Hashimoto
2023-12-18 19:07:38 -08:00
committed by GitHub
3 changed files with 20 additions and 12 deletions

View File

@ -39,6 +39,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Important so that build number generation works
fetch-depth: 0
# Install Nix and use that to run our tests so our environment matches exactly.
- uses: cachix/install-nix-action@v24
@ -57,7 +60,8 @@ jobs:
# Load Build Number
- name: Build Number
run: |
echo "GHOSTTY_BUILD=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "GHOSTTY_BUILD=$(git rev-list --count head)" >> $GITHUB_ENV
echo "GHOSTTY_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# GhosttyKit is the framework that is built from Zig for our native
# Mac app to access. Build this in release mode.
@ -74,8 +78,9 @@ jobs:
# This will be a monotonically always increasing build number that we use.
- name: Inject Build Number
run: |
echo "Setting build to $GHOSTTY_BUILD"
/usr/libexec/PlistBuddy -c "Set :GhosttyCommit $GHOSTTY_COMMIT" "macos/build/Release/Ghostty.app/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $GHOSTTY_BUILD" "macos/build/Release/Ghostty.app/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $GHOSTTY_COMMIT" "macos/build/Release/Ghostty.app/Contents/Info.plist"
- name: Zip Unsigned App
run: nix develop -c sh -c 'cd macos/build/Release && zip -9 -r --symlinks ../../../ghostty-macos-universal-unsigned.zip Ghostty.app'

View File

@ -91,5 +91,11 @@
<string>A program in Ghostty wants to use speech recognition.</string>
<key>NSSystemAdministrationUsageDescription</key>
<string>A program in Ghostty requires elevated privileges.</string>
<key>CFBundleVersion</key>
<string></string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>GhosttyCommit</key>
<string></string>
</dict>
</plist>

View File

@ -2,14 +2,9 @@ import SwiftUI
struct AboutView: View {
/// Read the commit from the bundle.
var commit: String {
guard let valueAny = Bundle.main.infoDictionary?["CFBundleVersion"],
let version = valueAny as? String else {
return "unknown"
}
return version
}
var build: String? { Bundle.main.infoDictionary?["CFBundleVersion"] as? String }
var commit: String? { Bundle.main.infoDictionary?["GhosttyCommit"] as? String }
var version: String? { Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String }
var body: some View {
VStack(alignment: .center) {
@ -21,9 +16,11 @@ struct AboutView: View {
Text("Ghostty")
.font(.title3)
Text("Commit: \(commit)")
if let version = self.version {
Text("Version: \(version)")
.font(.body)
}
}
.frame(minWidth: 300)
.padding()
}