From cf0a2001f0d5384d77db2e3ea97ae1b4ab080499 Mon Sep 17 00:00:00 2001 From: Magesh K <47920326+mahee96@users.noreply.github.com> Date: Wed, 18 Dec 2024 02:04:03 +0530 Subject: [PATCH] [Beta-Updates]: use BUILD_REVISION added as field in Info.plist instead of CURRENT_PROJECT_VERSION for commit ID marker --- .github/workflows/rebase.yml | 4 +-- AltBackup/Info.plist | 2 ++ AltStore/Info.plist | 2 ++ AltStoreCore/Info.plist | 2 ++ AltStoreCore/Model/InstalledApp.swift | 4 +-- AltWidget/Info.plist | 2 ++ Makefile | 36 ++++++++++++--------------- 7 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index e579ca04..761686b8 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -117,8 +117,8 @@ jobs: ls -la ~/Library/Developer/Xcode/DerivedData || true # List contents if directory exists echo "" - - name: Set current build as BETA - run: echo "IS_BETA=1" >> $GITHUB_ENV + - name: Set current build as ALPHA + run: echo "IS_ALPHA=1" >> $GITHUB_ENV - name: Build SideStore run: make build | xcpretty && exit ${PIPESTATUS[0]} diff --git a/AltBackup/Info.plist b/AltBackup/Info.plist index c169189d..87318f17 100644 --- a/AltBackup/Info.plist +++ b/AltBackup/Info.plist @@ -35,6 +35,8 @@ + BuildRevision + $(BUILD_REVISION) CFBundleVersion $(CURRENT_PROJECT_VERSION) LSRequiresIPhoneOS diff --git a/AltStore/Info.plist b/AltStore/Info.plist index a2d64e77..bf0ae238 100644 --- a/AltStore/Info.plist +++ b/AltStore/Info.plist @@ -81,6 +81,8 @@ CFBundleVersion $(CURRENT_PROJECT_VERSION) + BuildRevision + $(BUILD_REVISION) INIntentsSupported RefreshAllIntent diff --git a/AltStoreCore/Info.plist b/AltStoreCore/Info.plist index c0701c6d..cebb1257 100644 --- a/AltStoreCore/Info.plist +++ b/AltStoreCore/Info.plist @@ -16,6 +16,8 @@ $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString $(MARKETING_VERSION) + BuildRevision + $(BUILD_REVISION) CFBundleVersion $(CURRENT_PROJECT_VERSION) diff --git a/AltStoreCore/Model/InstalledApp.swift b/AltStoreCore/Model/InstalledApp.swift index a52b9927..1a52f6c2 100644 --- a/AltStoreCore/Model/InstalledApp.swift +++ b/AltStoreCore/Model/InstalledApp.swift @@ -107,8 +107,8 @@ public class InstalledApp: NSManagedObject, InstalledAppProtocol if(isBeta && !commitID.isEmpty){ let SHORT_COMMIT_LEN = 7 let isCommitIDValid = (commitID.count == SHORT_COMMIT_LEN) - let installedAppCommitID = Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as? String ?? "" -// let isBetaUpdateAvailable = (installedAppCommitID.count == commitID.count) && + let installedAppCommitID = Bundle.main.object(forInfoDictionaryKey: "BuildRevision") as? String ?? "" + // when installing beta build over stable build installedAppCommitID will be empty! let isBetaUpdateAvailable = (installedAppCommitID != commitID) return isCommitIDValid && isBetaUpdateAvailable } diff --git a/AltWidget/Info.plist b/AltWidget/Info.plist index 268dcc6b..cf410522 100644 --- a/AltWidget/Info.plist +++ b/AltWidget/Info.plist @@ -22,6 +22,8 @@ $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString $(MARKETING_VERSION) + BuildRevision + $(BUILD_REVISION) CFBundleVersion $(CURRENT_PROJECT_VERSION) NSExtension diff --git a/Makefile b/Makefile index de9051ec..a28b4b58 100755 --- a/Makefile +++ b/Makefile @@ -157,32 +157,28 @@ test: ## -- Building -- # Fetch the latest commit ID globally -BETA_COMMIT_ID := $(if $(IS_BETA),$(shell git rev-parse --short HEAD), "NONE") +ALPHA_COMMIT_ID := $(if $(IS_ALPHA),$(shell git rev-parse --short HEAD),) -# Fetch the latest commit ID if IS_BETA is defined -print_commit_id: - @echo "" - @if [ -n "$(IS_BETA)" ]; then \ - echo "'IS_BETA' is defined. Fetched the latest commit ID from HEAD..."; \ - echo " Commit ID: $(BETA_COMMIT_ID)"; \ - else \ - echo "'IS_BETA' is not defined. Skipping commit ID fetch."; \ - fi - @echo "" - -# Print release type based on the presence of BETA_COMMIT_ID +# Print release type based on the presence of ALPHA_COMMIT_ID print_release_type: - @if [ -z "$(BETA_COMMIT_ID)" ]; then \ - echo ">>>>>>>> This is now a STABLE release because BETA_COMMIT_ID = $(BETA_COMMIT_ID) <<<<<<<<<"; \ - echo " Using default CURRENT_PROJECT_VERSION from project.pbxproj."; \ + @echo "" + @if [ -n "$(IS_ALPHA)" ]; then \ + echo "'IS_ALPHA' is defined. Fetched the latest commit ID from HEAD..."; \ + echo " Commit ID: $(ALPHA_COMMIT_ID)"; \ + echo ""; \ + echo ">>>>>>>> This is now a ALPHA release for COMMIT_ID = '$(ALPHA_COMMIT_ID)' <<<<<<<<<"; \ + echo " Building with BUILD_REVISION = '$(ALPHA_COMMIT_ID)'"; \ else \ - echo ">>>>>>>> This is now a BETA release for BETA_COMMIT_ID = $(BETA_COMMIT_ID) <<<<<<<<<"; \ - echo " Building with CURRENT_PROJECT_VERSION=$(BETA_COMMIT_ID)"; \ + echo "'IS_ALPHA' is not defined. Skipping commit ID fetch."; \ + echo ""; \ + echo ">>>>>>>> This is now a STABLE release because IS_ALPHA was NOT SET <<<<<<<<<"; \ + echo " Building with BUILD_REVISION = '$(ALPHA_COMMIT_ID)'"; \ + echo ""; \ fi @echo "" # Build target with the print_commit_id dependency -build: print_commit_id print_release_type +build: print_release_type @xcodebuild -workspace AltStore.xcworkspace \ -scheme SideStore \ -sdk iphoneos \ @@ -193,7 +189,7 @@ build: print_commit_id print_release_type DEVELOPMENT_TEAM=XYZ0123456 \ ORG_IDENTIFIER=com.SideStore \ DWARF_DSYM_FOLDER_PATH="." \ - CURRENT_PROJECT_VERSION=$(BETA_COMMIT_ID) + BUILD_REVISION=$(ALPHA_COMMIT_ID) fakesign: rm -rf archive.xcarchive/Products/Applications/SideStore.app/Frameworks/AltStoreCore.framework/Frameworks/