Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update versioning to support stage suffix (#1274)
Leendert de Borst99414739376e
diff --git a/apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs b/apps/server/Shared/AliasVault.Shared.Core/AppInfo.csindex 7e92d6e7b..3498caf6c 100644--- a/apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs+++ b/apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs@@ -32,6 +32,11 @@ public static class AppInfo/// </summary>public const int VersionPatch = 2;+ /// <summary>+ /// Gets the version stage (e.g., "", "-alpha", "-beta", "-rc").+ /// </summary>+ public const string VersionStage = "";+/// <summary>/// Gets the minimum supported AliasVault client version. Normally the minimum client version is the same/// for all clients as we are using a monorepo to build all clients from the same source code. But it's@@ -85,7 +90,7 @@ public static class AppInfo/// <returns>The full version string.</returns>public static string GetFullVersion(){- var version = $"{VersionMajor}.{VersionMinor}.{VersionPatch}";+ var version = $"{VersionMajor}.{VersionMinor}.{VersionPatch}{VersionStage}";if (IsDevelopment){diff --git a/scripts/bump-version.sh b/scripts/bump-version.shindex f39842af9..c0f0a0292 100755--- a/scripts/bump-version.sh+++ b/scripts/bump-version.sh@@ -12,12 +12,24 @@ BUILD_ONLY=falseMARKETING_UPDATE=false# Function to generate semantic build number-# Format: MMmmppXX where MM=major, mm=minor, pp=patch, XX=build+# Format: MMmmppSXX where MM=major, mm=minor, pp=patch, S=stage, XX=build+# Stage: 1=alpha, 3=beta, 7=rc, 9=ga (general availability)generate_semantic_build_number() {local major=$1local minor=$2local patch=$3local build_increment=$4+ local version_suffix=$5++ # Determine stage based on version suffix+ local stage_num=9 # Default to GA+ if [[ "$version_suffix" =~ -alpha ]]; then+ stage_num=1+ elif [[ "$version_suffix" =~ -beta ]]; then+ stage_num=3+ elif [[ "$version_suffix" =~ -rc ]]; then+ stage_num=7+ fi# Pad with zeros and create build numberlocal major_padded=$(printf "%02d" $major)@@ -25,7 +37,7 @@ generate_semantic_build_number() {local patch_padded=$(printf "%02d" $patch)local build_padded=$(printf "%02d" $build_increment)- local semantic_build="${major_padded}${minor_padded}${patch_padded}${build_padded}"+ local semantic_build="${major_padded}${minor_padded}${patch_padded}${stage_num}${build_padded}"# Remove leading zeros for App Store compatibilityecho $((10#$semantic_build))@@ -38,14 +50,14 @@ extract_build_increment() {local version_minor=$3local version_patch=$4- # Pad the semantic build number to 8 digits with leading zeros- local padded_build=$(printf "%08d" $semantic_build)+ # Pad the semantic build number to 9 digits with leading zeros+ local padded_build=$(printf "%09d" $semantic_build)- # Generate the version prefix+ # Generate the version prefix (first 6 digits)local version_prefix=$(printf "%02d%02d%02d" $version_major $version_minor $version_patch)# Check if the build number starts with the expected version prefix- if [[ $padded_build == $version_prefix* ]]; then+ if [[ ${padded_build:0:6} == $version_prefix ]]; then# Extract the last 2 digits as the build incrementlocal build_increment=${padded_build: -2}# Remove leading zeros@@ -61,18 +73,22 @@ read_semver() {# Get current version from serverlocal current_major=$(grep "public const int VersionMajor = " ../apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs | tr -d ';' | tr -d ' ' | cut -d'=' -f2)local current_minor=$(grep "public const int VersionMinor = " ../apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs | tr -d ';' | tr -d ' ' | cut -d'=' -f2)+ local current_stage=$(grep "public const string VersionStage = " ../apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs | cut -d'"' -f2)local suggested_version="${current_major}.$((current_minor + 1)).0"while true; do- read -p "Enter new semantic version [$suggested_version]: " version+ read -p "Enter new semantic version (e.g. 1.2.3 or 1.2.3-alpha.1) [$suggested_version]: " version_input# If empty, use suggested version- if [[ -z "$version" ]]; then- version=$suggested_version+ if [[ -z "$version_input" ]]; then+ version_input=$suggested_versionfi- if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then+ # Extract base version and suffix+ if [[ $version_input =~ ^([0-9]+\.[0-9]+\.[0-9]+)((-[a-zA-Z]+)(\.[0-9]+)?)?$ ]]; then+ version=${BASH_REMATCH[1]}+ version_suffix=${BASH_REMATCH[2]}breakelse- echo "Invalid version format. Please use format X.Y.Z (e.g. $suggested_version)"+ echo "Invalid version format. Please use format X.Y.Z or X.Y.Z-suffix (e.g. $suggested_version or 1.2.3-alpha.1)"fidone}@@ -85,6 +101,7 @@ handle_semantic_build_number() {local version_minor=$4local version_patch=$5local is_marketing_update=$6+ local version_suffix=${version_suffix:-""}# Extract current build increment from semantic buildlocal current_increment=$(extract_build_increment "$current_build" "$version_major" "$version_minor" "$version_patch")@@ -110,9 +127,9 @@ handle_semantic_build_number() {if [[ $input -gt 99 ]]; theninput=99fi- generate_semantic_build_number "$version_major" "$version_minor" "$version_patch" "$input"+ generate_semantic_build_number "$version_major" "$version_minor" "$version_patch" "$input" "$version_suffix"else- generate_semantic_build_number "$version_major" "$version_minor" "$version_patch" "$suggested_increment"+ generate_semantic_build_number "$version_major" "$version_minor" "$version_patch" "$suggested_increment" "$version_suffix"fi}@@ -140,7 +157,8 @@ get_server_version() {local major=$(grep "public const int VersionMajor = " ../apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs | tr -d ';' | tr -d ' ' | cut -d'=' -f2)local minor=$(grep "public const int VersionMinor = " ../apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs | tr -d ';' | tr -d ' ' | cut -d'=' -f2)local patch=$(grep "public const int VersionPatch = " ../apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs | tr -d ';' | tr -d ' ' | cut -d'=' -f2)- echo "$major.$minor.$patch"+ local stage=$(grep "public const string VersionStage = " ../apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs | cut -d'"' -f2)+ echo "$major.$minor.$patch$stage"}# Function to extract version from browser extension config@@ -277,9 +295,20 @@ if [[ "$all_equal" == false ]]; thenfifi+# Initialize version_suffix variable+version_suffix=""+if [[ "$BUILD_ONLY" == true ]]; then# Use existing version- version=$first_version+ version_input=$first_version+ # Extract base version and suffix+ if [[ $version_input =~ ^([0-9]+\.[0-9]+\.[0-9]+)((-[a-zA-Z]+)(\.[0-9]+)?)?$ ]]; then+ version=${BASH_REMATCH[1]}+ version_suffix=${BASH_REMATCH[2]}+ else+ version=$version_input+ version_suffix=""+ fimajor=$(echo $version | cut -d. -f1)minor=$(echo $version | cut -d. -f2)patch=$(echo $version | cut -d. -f3)@@ -316,51 +345,57 @@ elif [[ "$MARKETING_UPDATE" == true ]]; thenupdate_version "../apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs" \"public const int VersionPatch = [0-9][0-9]*;" \"public const int VersionPatch = $patch;"+ update_version "../apps/server/Shared/AliasVault.Shared.Core/AppInfo.cs" \+ "public const string VersionStage = \"[^\"]*\";" \+ "public const string VersionStage = \"$version_suffix\";"++ # Build display version with suffix if present+ display_version="${version}${version_suffix}"# Update browser extension versionecho "Updating browser extension version..."update_version "../apps/browser-extension/wxt.config.ts" \- "version: \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"," \- "version: \"$version\","+ "version: \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^\"]*\"," \+ "version: \"$display_version\","# Update package.json versionecho "Updating package.json version..."update_version "../apps/browser-extension/package.json" \- "\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"," \- "\"version\": \"$version\","+ "\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^\"]*\"," \+ "\"version\": \"$display_version\","# Update browser extension AppInfo.ts versionecho "Updating browser extension AppInfo.ts version..."update_version "../apps/browser-extension/src/utils/AppInfo.ts" \- "public static readonly VERSION = '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*';" \- "public static readonly VERSION = '$version';"+ "public static readonly VERSION = '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^']*';" \+ "public static readonly VERSION = '$display_version';"# Update generic mobile app versionecho "Updating mobile app version..."update_version "../apps/mobile-app/utils/AppInfo.ts" \- "public static readonly VERSION = '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*';" \- "public static readonly VERSION = '$version';"+ "public static readonly VERSION = '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^']*';" \+ "public static readonly VERSION = '$display_version';"update_version "../apps/mobile-app/app.json" \- "\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"," \- "\"version\": \"$version\","+ "\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^\"]*\"," \+ "\"version\": \"$display_version\","# Update iOS app versionecho "Updating iOS app version..."update_version "../apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj" \- "MARKETING_VERSION = [0-9]\+\.[0-9]\+\.[0-9]\+;" \- "MARKETING_VERSION = $version;"+ "MARKETING_VERSION = [0-9]\+\.[0-9]\+\.[0-9]\+[^;]*;" \+ "MARKETING_VERSION = $display_version;"# Update Android app versionecho "Updating Android app version..."update_version "../apps/mobile-app/android/app/build.gradle" \- "versionName \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"" \- "versionName \"$version\""+ "versionName \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^\"]*\"" \+ "versionName \"$display_version\""# Update Safari extension versionecho "Updating Safari extension version..."update_version "../apps/browser-extension/safari-xcode/AliasVault/AliasVault.xcodeproj/project.pbxproj" \- "MARKETING_VERSION = [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*;" \- "MARKETING_VERSION = $version;"+ "MARKETING_VERSION = [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^;]*;" \+ "MARKETING_VERSION = $display_version;"fi# Handle build numbers with semantic versioning@@ -368,8 +403,21 @@ echo ""echo "--------------------------------"echo "Update semantic build numbers (for App Store releases)"echo "--------------------------------"-printf "Example for version %d.%d.%d: \"%02d%02d%02d00\" → %d (leading zeros removed)\n" $major $minor $patch $major $minor $patch $((10#$(printf "%02d%02d%02d00" $major $minor $patch)))-echo "> Breakdown: $(printf "%02d" $major) (major) $(printf "%02d" $minor) (minor) $(printf "%02d" $patch) (patch) 00 (build)"+echo "Format: MMmmppSXX (9 digits) where S=stage (1=alpha, 3=beta, 7=rc, 9=ga)"+if [[ -n "$version_suffix" ]]; then+ echo "Detected suffix: $version_suffix"+fi+printf "Example for version %d.%d.%d%s: \"" $major $minor $patch "$version_suffix"+if [[ "$version_suffix" =~ -alpha ]]; then+ printf "%02d%02d%02d100\" → %d" $major $minor $patch $((10#$(printf "%02d%02d%02d100" $major $minor $patch)))+elif [[ "$version_suffix" =~ -beta ]]; then+ printf "%02d%02d%02d300\" → %d" $major $minor $patch $((10#$(printf "%02d%02d%02d300" $major $minor $patch)))+elif [[ "$version_suffix" =~ -rc ]]; then+ printf "%02d%02d%02d700\" → %d" $major $minor $patch $((10#$(printf "%02d%02d%02d700" $major $minor $patch)))+else+ printf "%02d%02d%02d900\" → %d" $major $minor $patch $((10#$(printf "%02d%02d%02d900" $major $minor $patch)))+fi+echo " (leading zeros removed)"echo ""# Read current build numbers@@ -422,50 +470,55 @@ if [[ "$MARKETING_UPDATE" == true ]]; then# Install.sh reminder (only for version changes)echo "• If you've made changes to install.sh since the last release, remember to update its @version in the header to match this release version ($version)."- # Create empty changelog files and remind about them- echo "• Creating empty changelog files for version $version in the /fastlane directory..."-- # Create iOS changelog files- if [ -d "../fastlane/metadata/ios" ]; then- for lang_dir in ../fastlane/metadata/ios/*/; do- if [ -d "$lang_dir" ]; then- lang=$(basename "$lang_dir")- changelog_dir="$lang_dir/changelogs"- mkdir -p "$changelog_dir"- touch "$changelog_dir/$new_ios_build.txt"- fi- done- fi+ # Only create changelog files for GA releases (not alpha, beta, or rc)+ if [[ -z "$version_suffix" ]]; then+ # Create empty changelog files and remind about them+ echo "• Creating empty changelog files for GA version $version in the /fastlane directory..."++ # Create iOS changelog files+ if [ -d "../fastlane/metadata/ios" ]; then+ for lang_dir in ../fastlane/metadata/ios/*/; do+ if [ -d "$lang_dir" ]; then+ lang=$(basename "$lang_dir")+ changelog_dir="$lang_dir/changelogs"+ mkdir -p "$changelog_dir"+ touch "$changelog_dir/$new_ios_build.txt"+ fi+ done+ fi- # Create Android changelog files- if [ -d "../fastlane/metadata/android" ]; then- for lang_dir in ../fastlane/metadata/android/*/; do- if [ -d "$lang_dir" ]; then- lang=$(basename "$lang_dir")- changelog_dir="$lang_dir/changelogs"- mkdir -p "$changelog_dir"- touch "$changelog_dir/$new_android_build.txt"- fi- done- fi+ # Create Android changelog files+ if [ -d "../fastlane/metadata/android" ]; then+ for lang_dir in ../fastlane/metadata/android/*/; do+ if [ -d "$lang_dir" ]; then+ lang=$(basename "$lang_dir")+ changelog_dir="$lang_dir/changelogs"+ mkdir -p "$changelog_dir"+ touch "$changelog_dir/$new_android_build.txt"+ fi+ done+ fi- # Create Browser Extension changelog files- if [ -d "../fastlane/metadata/browser-extension" ]; then- for lang_dir in ../fastlane/metadata/browser-extension/*/; do- if [ -d "$lang_dir" ]; then- lang=$(basename "$lang_dir")- changelog_dir="$lang_dir/changelogs"- mkdir -p "$changelog_dir"- touch "$changelog_dir/$version.txt"- fi- done- fi+ # Create Browser Extension changelog files+ if [ -d "../fastlane/metadata/browser-extension" ]; then+ for lang_dir in ../fastlane/metadata/browser-extension/*/; do+ if [ -d "$lang_dir" ]; then+ lang=$(basename "$lang_dir")+ changelog_dir="$lang_dir/changelogs"+ mkdir -p "$changelog_dir"+ touch "$changelog_dir/$version.txt"+ fi+ done+ fi- echo ""- echo "• Please fill in the changelog content in the created files:"- echo " - iOS: fastlane/metadata/ios/[lang]/changelogs/$new_ios_build.txt"- echo " - Android: fastlane/metadata/android/[lang]/changelogs/$new_android_build.txt"- echo " - Browser Extension: fastlane/metadata/browser-extension/[lang]/changelogs/$version.txt"+ echo ""+ echo "• Please fill in the changelog content in the created files:"+ echo " - iOS: fastlane/metadata/ios/[lang]/changelogs/$new_ios_build.txt"+ echo " - Android: fastlane/metadata/android/[lang]/changelogs/$new_android_build.txt"+ echo " - Browser Extension: fastlane/metadata/browser-extension/[lang]/changelogs/$version.txt"+ else+ echo "• Skipping changelog creation for pre-release version $display_version (only GA releases get published to app stores)"+ fielif [[ "$BUILD_ONLY" == true ]]; thenecho " Marketing version remained at: $version"echo " Only build numbers were incremented"