[Beta-Updates]: use BUILD_REVISION added as field in Info.plist instead of CURRENT_PROJECT_VERSION for commit ID marker

This commit is contained in:
Magesh K
2024-12-18 02:04:03 +05:30
parent cfe2111844
commit cf0a2001f0
7 changed files with 28 additions and 24 deletions

View File

@@ -117,8 +117,8 @@ jobs:
ls -la ~/Library/Developer/Xcode/DerivedData || true # List contents if directory exists ls -la ~/Library/Developer/Xcode/DerivedData || true # List contents if directory exists
echo "" echo ""
- name: Set current build as BETA - name: Set current build as ALPHA
run: echo "IS_BETA=1" >> $GITHUB_ENV run: echo "IS_ALPHA=1" >> $GITHUB_ENV
- name: Build SideStore - name: Build SideStore
run: make build | xcpretty && exit ${PIPESTATUS[0]} run: make build | xcpretty && exit ${PIPESTATUS[0]}

View File

@@ -35,6 +35,8 @@
</array> </array>
</dict> </dict>
</array> </array>
<key>BuildRevision</key>
<string>$(BUILD_REVISION)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>

View File

@@ -81,6 +81,8 @@
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>BuildRevision</key>
<string>$(BUILD_REVISION)</string>
<key>INIntentsSupported</key> <key>INIntentsSupported</key>
<array> <array>
<string>RefreshAllIntent</string> <string>RefreshAllIntent</string>

View File

@@ -16,6 +16,8 @@
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string> <string>$(MARKETING_VERSION)</string>
<key>BuildRevision</key>
<string>$(BUILD_REVISION)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
</dict> </dict>

View File

@@ -107,8 +107,8 @@ public class InstalledApp: NSManagedObject, InstalledAppProtocol
if(isBeta && !commitID.isEmpty){ if(isBeta && !commitID.isEmpty){
let SHORT_COMMIT_LEN = 7 let SHORT_COMMIT_LEN = 7
let isCommitIDValid = (commitID.count == SHORT_COMMIT_LEN) let isCommitIDValid = (commitID.count == SHORT_COMMIT_LEN)
let installedAppCommitID = Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as? String ?? "" let installedAppCommitID = Bundle.main.object(forInfoDictionaryKey: "BuildRevision") as? String ?? ""
// let isBetaUpdateAvailable = (installedAppCommitID.count == commitID.count) && // when installing beta build over stable build installedAppCommitID will be empty!
let isBetaUpdateAvailable = (installedAppCommitID != commitID) let isBetaUpdateAvailable = (installedAppCommitID != commitID)
return isCommitIDValid && isBetaUpdateAvailable return isCommitIDValid && isBetaUpdateAvailable
} }

View File

@@ -22,6 +22,8 @@
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string> <string>$(MARKETING_VERSION)</string>
<key>BuildRevision</key>
<string>$(BUILD_REVISION)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSExtension</key> <key>NSExtension</key>

View File

@@ -157,32 +157,28 @@ test:
## -- Building -- ## -- Building --
# Fetch the latest commit ID globally # 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 release type based on the presence of ALPHA_COMMIT_ID
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: print_release_type:
@if [ -z "$(BETA_COMMIT_ID)" ]; then \ @echo ""
echo ">>>>>>>> This is now a STABLE release because BETA_COMMIT_ID = $(BETA_COMMIT_ID) <<<<<<<<<"; \ @if [ -n "$(IS_ALPHA)" ]; then \
echo " Using default CURRENT_PROJECT_VERSION from project.pbxproj."; \ 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 \ else \
echo ">>>>>>>> This is now a BETA release for BETA_COMMIT_ID = $(BETA_COMMIT_ID) <<<<<<<<<"; \ echo "'IS_ALPHA' is not defined. Skipping commit ID fetch."; \
echo " Building with CURRENT_PROJECT_VERSION=$(BETA_COMMIT_ID)"; \ echo ""; \
echo ">>>>>>>> This is now a STABLE release because IS_ALPHA was NOT SET <<<<<<<<<"; \
echo " Building with BUILD_REVISION = '$(ALPHA_COMMIT_ID)'"; \
echo ""; \
fi fi
@echo "" @echo ""
# Build target with the print_commit_id dependency # Build target with the print_commit_id dependency
build: print_commit_id print_release_type build: print_release_type
@xcodebuild -workspace AltStore.xcworkspace \ @xcodebuild -workspace AltStore.xcworkspace \
-scheme SideStore \ -scheme SideStore \
-sdk iphoneos \ -sdk iphoneos \
@@ -193,7 +189,7 @@ build: print_commit_id print_release_type
DEVELOPMENT_TEAM=XYZ0123456 \ DEVELOPMENT_TEAM=XYZ0123456 \
ORG_IDENTIFIER=com.SideStore \ ORG_IDENTIFIER=com.SideStore \
DWARF_DSYM_FOLDER_PATH="." \ DWARF_DSYM_FOLDER_PATH="." \
CURRENT_PROJECT_VERSION=$(BETA_COMMIT_ID) BUILD_REVISION=$(ALPHA_COMMIT_ID)
fakesign: fakesign:
rm -rf archive.xcarchive/Products/Applications/SideStore.app/Frameworks/AltStoreCore.framework/Frameworks/ rm -rf archive.xcarchive/Products/Applications/SideStore.app/Frameworks/AltStoreCore.framework/Frameworks/