Automatically increment versions based on git release tag

This commit is contained in:
Andrea Alberti 2025-09-30 13:33:59 +02:00
parent 453ba9dff2
commit 25d7799dd9
3 changed files with 45 additions and 19 deletions

View File

@ -1080,16 +1080,14 @@ static NSTimeInterval updateSystemVolumeInterval=0.1f;
- (IBAction)aboutPanel:(id)sender
{
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
NSString* version = [infoDict objectForKey:@"CFBundleVersion"];
NSRange range=[version rangeOfString:@"." options:NSBackwardsSearch];
if(version>0) version=[version substringFromIndex:range.location+1];
infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
version,@"Version",
nil ]; // terminate the list
NSString *shortVersion = infoDict[@"CFBundleShortVersionString"]; // e.g. "1.7.7"
NSString *buildNumber = infoDict[@"CFBundleVersion"]; // e.g. "190"
NSDictionary *options = @{NSAboutPanelOptionApplicationVersion: shortVersion, NSAboutPanelOptionVersion: buildNumber};
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
[[NSApplication sharedApplication] orderFrontStandardAboutPanelWithOptions:infoDict];
[[NSApplication sharedApplication] orderFrontStandardAboutPanelWithOptions:options];
}
- (void) receiveWakeNote: (NSNotification*) note

View File

@ -360,6 +360,7 @@
65996C53267EA86A0080A9A5 /* Resources */,
65EF8F5C2E888C9500AAE7B7 /* Embed Frameworks */,
65DBBEF12E89EB4D00752329 /* Embed Login Helper */,
65A565702E8BEF1C00A9DF0D /* Update Info.plist Version from Git */,
);
buildRules = (
);
@ -452,6 +453,27 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
65A565702E8BEF1C00A9DF0D /* Update Info.plist Version from Git */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Update Info.plist Version from Git";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Set CFBundleShortVersionString from the latest tag\nversionTag=$(git describe --tags --abbrev=0)\nversionTag=${versionTag#v}\n\n# Set CFBundleVersion (build number) to the number of commits\nbuildNumber=$(git rev-list --count HEAD)\n/usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString ${versionTag}\" \\\n \"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}\"\n\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion ${buildNumber}\" \\\n \"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
65996C51267EA86A0080A9A5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@ -605,11 +627,13 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 0000000000;
ENABLE_APP_SANDBOX = NO;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_RESOURCE_ACCESS_PHOTO_LIBRARY = NO;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
@ -622,6 +646,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.5;
MARKETING_VERSION = 0.0.0;
PRODUCT_BUNDLE_IDENTIFIER = io.your.company.VolumeControl;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -644,11 +669,13 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 0000000000;
ENABLE_APP_SANDBOX = NO;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_RESOURCE_ACCESS_PHOTO_LIBRARY = NO;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
@ -661,6 +688,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.5;
MARKETING_VERSION = 0.0.0;
PRODUCT_BUNDLE_IDENTIFIER = io.your.company.VolumeControl;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -681,7 +709,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = 0000000000;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
@ -731,7 +759,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = 0000000000;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;

View File

@ -13,9 +13,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.7.7</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1.7.7.111</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>