Merge commit '99b07c2ee14dea1383ca6cd63633c3df542f2955' into canary

This commit is contained in:
DarkSky
2026-03-04 01:18:30 +08:00

View File

@@ -73,8 +73,8 @@ update_app_stream_version() {
update_ios_marketing_version() {
local file_path=$1
# Remove everything after the "-"
local new_version=$(echo "$2" | sed -E 's/-.*$//')
# Normalize inputs like "v0.26.4-beta.1" to "0.26.4"
local new_version=$(echo "$2" | sed -E 's/^v//; s/-.*$//')
# Check if file exists
if [ ! -f "$file_path" ]; then
@@ -98,8 +98,56 @@ update_ios_marketing_version() {
rm "$file_path".bak
}
# Derive a date-based iOS MARKETING_VERSION from the latest stable/beta tag.
# Apple requires CFBundleShortVersionString to increase monotonically. Using
# date-based versions (YYYY.M.D) derived from the last stable/beta release tag
# ensures this. The user-facing App Store version is set separately in
# App Store Connect.
get_ios_version_from_git() {
# Find the most recent stable/beta tag reachable from HEAD (exclude canary/nightly)
local latest_tag
latest_tag=$(git describe --tags --match 'v[0-9]*' \
--exclude '*canary*' --exclude '*nightly*' \
--abbrev=0 HEAD 2>/dev/null)
if [ -z "$latest_tag" ]; then
# No stable/beta tag found, fall back to today's date
date +"%Y.%-m.%-d"
return
fi
# Get the tag creation date (tagger date for annotated tags, commit date for lightweight)
local tag_date
tag_date=$(git for-each-ref --format='%(creatordate:short)' "refs/tags/$latest_tag")
if [ -z "$tag_date" ]; then
date +"%Y.%-m.%-d"
return
fi
# Format as YYYY.M.D (no leading zeros for month/day)
local year month day
year=$(echo "$tag_date" | cut -d'-' -f1)
month=$((10#$(echo "$tag_date" | cut -d'-' -f2)))
day=$((10#$(echo "$tag_date" | cut -d'-' -f3)))
echo "${year}.${month}.${day}"
}
new_version=$1
ios_new_version=${IOS_APP_VERSION:-$new_version}
if [ -n "$IOS_APP_VERSION" ]; then
# Manual override via environment variable
ios_new_version=$IOS_APP_VERSION
elif echo "$new_version" | grep -qE '(canary|nightly)'; then
# Canary/nightly: use the date of the last stable/beta tag
ios_new_version=$(get_ios_version_from_git)
else
# Stable/beta release: use today's date
ios_new_version=$(date +"%Y.%-m.%-d")
fi
echo "iOS MARKETING_VERSION: $ios_new_version (app version: $new_version)"
update_app_version_in_helm_charts ".github/helm/affine/Chart.yaml" "$new_version"
update_app_version_in_helm_charts ".github/helm/affine/charts/graphql/Chart.yaml" "$new_version"
@@ -108,4 +156,4 @@ update_app_version_in_helm_charts ".github/helm/affine/charts/doc/Chart.yaml" "$
update_app_stream_version "packages/frontend/apps/electron/resources/affine.metainfo.xml" "$new_version"
update_ios_marketing_version "packages/frontend/apps/ios/App/App.xcodeproj/project.pbxproj" "$new_version"
update_ios_marketing_version "packages/frontend/apps/ios/App/App.xcodeproj/project.pbxproj" "$ios_new_version"