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: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 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. # Install Nix and use that to run our tests so our environment matches exactly.
- uses: cachix/install-nix-action@v24 - uses: cachix/install-nix-action@v24
@ -57,7 +60,8 @@ jobs:
# Load Build Number # Load Build Number
- name: Build Number - name: Build Number
run: | 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 # GhosttyKit is the framework that is built from Zig for our native
# Mac app to access. Build this in release mode. # 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. # This will be a monotonically always increasing build number that we use.
- name: Inject Build Number - name: Inject Build Number
run: | 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 :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 - 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' 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> <string>A program in Ghostty wants to use speech recognition.</string>
<key>NSSystemAdministrationUsageDescription</key> <key>NSSystemAdministrationUsageDescription</key>
<string>A program in Ghostty requires elevated privileges.</string> <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> </dict>
</plist> </plist>

View File

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