Some checks failed
Build & Test / Analyze (javascript, affine) (push) Failing after 4s
Build & Test / Analyze (typescript, affine) (push) Failing after 3s
Build & Test / Rust test filter (push) Failing after 4s
Build & Test / Check yarn binary (push) Failing after 3s
Build & Test / E2E BlockSuite Test (3) (push) Failing after 3s
Build & Test / Analyze (javascript, blocksuite) (push) Failing after 3s
Build & Test / Analyze (typescript, blocksuite) (push) Failing after 3s
Build & Test / Mobile native build filter (push) Failing after 3s
Build & Test / E2E BlockSuite Test (1) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (2) (push) Failing after 4s
Build & Test / E2E Mobile Test (1) (push) Failing after 3s
Build & Test / Unit Test (1) (push) Has been skipped
Build & Test / Unit Test (2) (push) Has been skipped
Build & Test / Unit Test (3) (push) Has been skipped
Build & Test / Unit Test (4) (push) Has been skipped
Build & Test / Unit Test (5) (push) Has been skipped
Build & Test / Native Unit Test (push) Has been skipped
Build & Test / E2E BlockSuite Test (4) (push) Failing after 3s
Build & Test / E2E BlockSuite Test (5) (push) Failing after 3s
Build & Test / E2E BlockSuite Cross Browser Test (push) Failing after 3s
Build & Test / E2E Mobile Test (2) (push) Failing after 3s
Build & Test / Build AFFiNE native (x86_64-unknown-linux-gnu) (push) Failing after 3s
Build & Test / Build Server native (push) Failing after 3s
Build & Test / Check Git Status (push) Has been skipped
Build & Test / Server Test (0, 4) (push) Has been skipped
Build & Test / Server Test (1, 4) (push) Has been skipped
Build & Test / Server Test (2, 4) (push) Has been skipped
Build & Test / Server Test (3, 4) (push) Has been skipped
Build & Test / Server Test with Elasticsearch (push) Has been skipped
Build & Test / Build @affine/electron renderer (push) Failing after 3s
Build & Test / Copilot test filter (push) Failing after 4s
Build & Test / Lint Rust (push) Has been skipped
Build & Test / Server Test with Embedded Search (push) Has been skipped
Build & Test / Server Test with Manticore Search (push) Has been skipped
Build & Test / Server E2E Test (push) Has been skipped
Build & Test / Cloud Desktop E2E Test (push) Has been skipped
Build & Test / Cloud E2E Test 1/2 (push) Has been skipped
Build & Test / Cloud E2E Test 2/2 (push) Has been skipped
Build & Test / Build Android app (push) Has been skipped
Build & Test / Test Android app (push) Has been skipped
Build & Test / Run native tests (push) Has been skipped
Build & Test / Server Copilot Api Test (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (1, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (2, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (3, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (4, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (5, 5) (push) Has been skipped
Release / Canary Gate (push) Has been skipped
Build & Test / Build AFFiNE native (aarch64-apple-darwin) (push) Has been cancelled
Build & Test / Lint (push) Has been cancelled
Build & Test / Typecheck (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-apple-darwin) (push) Has been cancelled
Build & Test / Desktop Test (ubuntu-latest, linux, x64, x86_64-unknown-linux-gnu, true) (push) Has been cancelled
Build & Test / Desktop Test (windows-latest, windows, x64, x86_64-pc-windows-msvc, true) (push) Has been cancelled
Build & Test / E2E Test (1) (push) Has been cancelled
Build & Test / E2E Test (2) (push) Has been cancelled
Build & Test / E2E Test (3) (push) Has been cancelled
Build & Test / E2E Test (4) (push) Has been cancelled
Build & Test / E2E Test (5) (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, arm64, aarch64-apple-darwin, true) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, x64, x86_64-apple-darwin, false) (push) Has been cancelled
Build & Test / 3, 2, 1 Launch (push) Has been cancelled
Build & Test / Build iOS app (push) Has been cancelled
Copilot Test Automatically / Setup Test (push) Failing after 2s
Release / Prepare (push) Failing after 1s
Release / Release Mobile (push) Has been skipped
Release / Release Desktop (push) Has been skipped
Release / Release Docker Image (push) Has been skipped
Release / Release Cloud (push) Has been skipped
154 lines
5.1 KiB
Bash
Executable File
154 lines
5.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
for DIR_ITEM in $(yarn workspaces list --json | jq -r '.location'); do
|
|
DIR=$(echo -n "$DIR_ITEM" | tr -d '\r\n')
|
|
if [ -f "$DIR/package.json" ]; then
|
|
echo "Setting version for $DIR"
|
|
jq ".version = \"$1\"" "$DIR"/package.json > tmp.json && mv tmp.json "$DIR"/package.json
|
|
else
|
|
echo "No package.json found in: $DIR"
|
|
fi
|
|
done
|
|
|
|
update_app_version_in_helm_charts() {
|
|
local file_path=$1
|
|
local new_version=$2
|
|
|
|
# Check if file exists
|
|
if [ ! -f "$file_path" ]; then
|
|
echo "Error: File does not exist at $file_path."
|
|
return 1
|
|
fi
|
|
|
|
echo "Updating $file_path with appVersion $new_version"
|
|
|
|
# Use sed to replace the appVersion value with the new version.
|
|
sed -i.bak -E "s/^appVersion:[[:space:]]+[\"']?.*[\"']?$/appVersion: \"$new_version\"/" "$file_path" || {
|
|
# If the sed command fails, print an error message and exit with a non-zero status
|
|
echo "Error: Failed to update the appVersion in $file_path."
|
|
return 1
|
|
}
|
|
|
|
echo "appVersion in $file_path updated to $new_version"
|
|
|
|
rm "$file_path".bak
|
|
}
|
|
|
|
update_app_stream_version() {
|
|
local file_path=$1
|
|
local new_version=$2
|
|
|
|
# Check if file exists
|
|
if [ ! -f "$file_path" ]; then
|
|
echo "Error: File does not exist at $file_path."
|
|
return 1
|
|
fi
|
|
|
|
echo "Updating $file_path with appVersion $new_version"
|
|
# version is at
|
|
# <releases>
|
|
# <release version="0.21.0" date="yyyy-MM-dd">
|
|
# <url>https://github.com/toeverything/AFFiNE/releases/tag/v0.21.0</url>
|
|
# </release>
|
|
# </releases>
|
|
# We need to update the version and the url
|
|
current_date=$(date +"%Y-%m-%d")
|
|
|
|
# Use sed to update the version, date, and URL in the releases section
|
|
sed -i.bak -E "s|<release version=\"[^\"]*\" date=\"[^\"]*\">|<release version=\"$new_version\" date=\"$current_date\">|" "$file_path" &&
|
|
sed -i.bak -E "s|<url>https://github.com/toeverything/AFFiNE/releases/tag/v[^<]*</url>|<url>https://github.com/toeverything/AFFiNE/releases/tag/v$new_version</url>|" "$file_path" || {
|
|
# If the sed command fails, print an error message and exit with a non-zero status
|
|
echo "Error: Failed to update the appVersion."
|
|
return 1
|
|
}
|
|
|
|
echo "appVersion in $file_path updated to $new_version"
|
|
|
|
rm "$file_path".bak
|
|
}
|
|
|
|
update_ios_marketing_version() {
|
|
local file_path=$1
|
|
# 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
|
|
echo "Error: File does not exist at $file_path."
|
|
return 1
|
|
fi
|
|
|
|
echo "Updating $file_path with MARKETING_VERSION $new_version"
|
|
|
|
# Use sed to replace the MARKETING_VERSION value with the new version
|
|
sed -i.bak -E "s/MARKETING_VERSION = [^;]*;/MARKETING_VERSION = $new_version;/g" "$file_path" || {
|
|
# If the sed command fails, print an error message and exit with a non-zero status
|
|
echo "Error: Failed to update the MARKETING_VERSION."
|
|
return 1
|
|
}
|
|
|
|
echo "MARKETING_VERSION in $file_path updated to $new_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
|
|
|
|
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"
|
|
update_app_version_in_helm_charts ".github/helm/affine/charts/front/Chart.yaml" "$new_version"
|
|
|
|
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" "$ios_new_version"
|