mirror of
https://github.com/bitwarden/android.git
synced 2025-12-12 18:41:10 -06:00
Commonize version name and bump it (#5559)
This commit is contained in:
parent
a6d622c3b9
commit
f614d6039f
6
.github/workflows/build-authenticator.yml
vendored
6
.github/workflows/build-authenticator.yml
vendored
@ -219,12 +219,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
DEFAULT_VERSION_CODE=$GITHUB_RUN_NUMBER
|
DEFAULT_VERSION_CODE=$GITHUB_RUN_NUMBER
|
||||||
VERSION_CODE="${{ inputs.version-code || '$DEFAULT_VERSION_CODE' }}"
|
VERSION_CODE="${{ inputs.version-code || '$DEFAULT_VERSION_CODE' }}"
|
||||||
bundle exec fastlane setAuthenticatorBuildVersionInfo \
|
bundle exec fastlane setBuildVersionInfo \
|
||||||
versionCode:$VERSION_CODE \
|
versionCode:$VERSION_CODE \
|
||||||
versionName:${{ inputs.version-name || '' }}
|
versionName:${{ inputs.version-name || '' }}
|
||||||
|
|
||||||
regex='versionName = "([^"]+)"'
|
regex='appVersionName = "([^"]+)"'
|
||||||
if [[ "$(cat authenticator/build.gradle.kts)" =~ $regex ]]; then
|
if [[ "$(cat gradle/libs.versions.toml)" =~ $regex ]]; then
|
||||||
VERSION_NAME="${BASH_REMATCH[1]}"
|
VERSION_NAME="${BASH_REMATCH[1]}"
|
||||||
fi
|
fi
|
||||||
echo "Version Name: ${VERSION_NAME}" >> $GITHUB_STEP_SUMMARY
|
echo "Version Name: ${VERSION_NAME}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|||||||
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -525,8 +525,8 @@ jobs:
|
|||||||
versionCode:$VERSION_CODE \
|
versionCode:$VERSION_CODE \
|
||||||
versionName:${{ inputs.version-name || '' }}
|
versionName:${{ inputs.version-name || '' }}
|
||||||
|
|
||||||
regex='versionName = "([^"]+)"'
|
regex='appVersionName = "([^"]+)"'
|
||||||
if [[ "$(cat app/build.gradle.kts)" =~ $regex ]]; then
|
if [[ "$(cat gradle/libs.versions.toml)" =~ $regex ]]; then
|
||||||
VERSION_NAME="${BASH_REMATCH[1]}"
|
VERSION_NAME="${BASH_REMATCH[1]}"
|
||||||
fi
|
fi
|
||||||
echo "Version Name: ${VERSION_NAME}" >> $GITHUB_STEP_SUMMARY
|
echo "Version Name: ${VERSION_NAME}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|||||||
@ -55,8 +55,8 @@ android {
|
|||||||
applicationId = "com.x8bit.bitwarden"
|
applicationId = "com.x8bit.bitwarden"
|
||||||
minSdk = libs.versions.minSdk.get().toInt()
|
minSdk = libs.versions.minSdk.get().toInt()
|
||||||
targetSdk = libs.versions.targetSdk.get().toInt()
|
targetSdk = libs.versions.targetSdk.get().toInt()
|
||||||
versionCode = 1
|
versionCode = libs.versions.appVersionCode.get().toInt()
|
||||||
versionName = "2025.7.0"
|
versionName = libs.versions.appVersionName.get()
|
||||||
|
|
||||||
setProperty("archivesBaseName", "com.x8bit.bitwarden")
|
setProperty("archivesBaseName", "com.x8bit.bitwarden")
|
||||||
|
|
||||||
|
|||||||
@ -30,8 +30,8 @@ android {
|
|||||||
applicationId = "com.bitwarden.authenticator"
|
applicationId = "com.bitwarden.authenticator"
|
||||||
minSdk = libs.versions.minSdkBwa.get().toInt()
|
minSdk = libs.versions.minSdkBwa.get().toInt()
|
||||||
targetSdk = libs.versions.targetSdk.get().toInt()
|
targetSdk = libs.versions.targetSdk.get().toInt()
|
||||||
versionCode = 1
|
versionCode = libs.versions.appVersionCode.get().toInt()
|
||||||
versionName = "2025.7.0"
|
versionName = libs.versions.appVersionName.get()
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
@ -126,14 +126,14 @@ platform :android do
|
|||||||
fastlane_require "time"
|
fastlane_require "time"
|
||||||
lane :setBuildVersionInfo do |options|
|
lane :setBuildVersionInfo do |options|
|
||||||
|
|
||||||
# Read-in app build config file.
|
# Read-in app toml file.
|
||||||
buildConfigPath = "../app/build.gradle.kts"
|
tomlLibraryPath = "../gradle/libs.versions.toml"
|
||||||
buildConfigFile = File.open(buildConfigPath)
|
tomlLibraryFile = File.open(tomlLibraryPath)
|
||||||
buildConfigText = buildConfigFile.read
|
tomlLibraryText = tomlLibraryFile.read
|
||||||
buildConfigFile.close
|
tomlLibraryFile.close
|
||||||
|
|
||||||
currentVersionCode = buildConfigText.match(/versionCode = (\d+)/).captures[0]
|
currentVersionCode = tomlLibraryText.match(/appVersionCode = "(\d+)"/).captures[0]
|
||||||
currentVersionName = buildConfigText.match(/versionName = "(.+)"/).captures[0]
|
currentVersionName = tomlLibraryText.match(/appVersionName = "(.+)"/).captures[0]
|
||||||
|
|
||||||
if options[:versionName].nil? or options[:versionName].to_s.empty?
|
if options[:versionName].nil? or options[:versionName].to_s.empty?
|
||||||
puts "Fetching latest tags from origin..."
|
puts "Fetching latest tags from origin..."
|
||||||
@ -164,12 +164,12 @@ platform :android do
|
|||||||
|
|
||||||
# Replace version information.
|
# Replace version information.
|
||||||
puts "Setting version code to #{options[:versionCode]}."
|
puts "Setting version code to #{options[:versionCode]}."
|
||||||
buildConfigText.gsub!("versionCode = #{currentVersionCode}", "versionCode = #{options[:versionCode]}")
|
tomlLibraryText.gsub!("appVersionCode = \"#{currentVersionCode}\"", "appVersionCode = \"#{options[:versionCode]}\"")
|
||||||
puts "Setting version name to #{nextVersionName}."
|
puts "Setting version name to #{nextVersionName}."
|
||||||
buildConfigText.gsub!("versionName = \"#{currentVersionName}\"", "versionName = \"#{nextVersionName}\"")
|
tomlLibraryText.gsub!("appVersionName = \"#{currentVersionName}\"", "appVersionName = \"#{nextVersionName}\"")
|
||||||
|
|
||||||
# Save changes
|
# Save changes
|
||||||
File.open(buildConfigPath, "w") { |buildConfigFile| buildConfigFile << buildConfigText }
|
File.open(tomlLibraryPath, "w") { |tomlLibraryFile| tomlLibraryFile << tomlLibraryText }
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Generate artifacts for the given [build] signed with the provided [keystore] and credentials."
|
desc "Generate artifacts for the given [build] signed with the provided [keystore] and credentials."
|
||||||
@ -302,57 +302,6 @@ platform :android do
|
|||||||
UI.message("version_number: #{latest_version_number}")
|
UI.message("version_number: #{latest_version_number}")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Authenticator
|
|
||||||
desc "Apply build version information"
|
|
||||||
fastlane_require "time"
|
|
||||||
lane :setAuthenticatorBuildVersionInfo do |options|
|
|
||||||
|
|
||||||
# Read-in app build config file.
|
|
||||||
buildConfigPath = "../authenticator/build.gradle.kts"
|
|
||||||
buildConfigFile = File.open(buildConfigPath)
|
|
||||||
buildConfigText = buildConfigFile.read
|
|
||||||
buildConfigFile.close
|
|
||||||
|
|
||||||
currentVersionCode = buildConfigText.match(/versionCode = (\d+)/).captures[0]
|
|
||||||
currentVersionName = buildConfigText.match(/versionName = "(.+)"/).captures[0]
|
|
||||||
|
|
||||||
if options[:versionName].nil? or options[:versionName].to_s.empty?
|
|
||||||
puts "Fetching latest tags from origin..."
|
|
||||||
`git fetch --prune --no-recurse-submodules --filter=tree:0 --depth=1 --tags origin`
|
|
||||||
puts "Getting latest version name from previous git tag..."
|
|
||||||
latestTag = `git describe --tags $(git rev-list --tags --max-count=1)`.chomp()
|
|
||||||
puts "Using tag #{latestTag} to calculate version name..."
|
|
||||||
latestTag.slice!(0)
|
|
||||||
puts "Current version name resolved to #{latestTag}."
|
|
||||||
|
|
||||||
versionParts = latestTag.split(".")
|
|
||||||
currentMajor = versionParts[0]
|
|
||||||
currentMinor = versionParts[1]
|
|
||||||
currentRevision = versionParts[2]
|
|
||||||
|
|
||||||
currentDate = Time.new
|
|
||||||
major = currentDate.year.to_s
|
|
||||||
minor = currentDate.strftime "%-m"
|
|
||||||
|
|
||||||
revision = 0
|
|
||||||
if currentMajor == major and currentMinor == minor
|
|
||||||
revision = currentRevision.to_i + 1
|
|
||||||
end
|
|
||||||
nextVersionName = "#{major}.#{minor}.#{revision}"
|
|
||||||
else
|
|
||||||
nextVersionName = options[:versionName].to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
# Replace version information.
|
|
||||||
puts "Setting version code to #{options[:versionCode]}."
|
|
||||||
buildConfigText.gsub!("versionCode = #{currentVersionCode}", "versionCode = #{options[:versionCode]}")
|
|
||||||
puts "Setting version name to #{nextVersionName}."
|
|
||||||
buildConfigText.gsub!("versionName = \"#{currentVersionName}\"", "versionName = \"#{nextVersionName}\"")
|
|
||||||
|
|
||||||
# Save changes
|
|
||||||
File.open(buildConfigPath, "w") { |buildConfigFile| buildConfigFile << buildConfigText }
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "Assemble debug variants"
|
desc "Assemble debug variants"
|
||||||
lane :buildAuthenticatorDebug do
|
lane :buildAuthenticatorDebug do
|
||||||
gradle(
|
gradle(
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
android.experimental.enableTestFixturesKotlinSupport=true
|
android.experimental.enableTestFixturesKotlinSupport=true
|
||||||
android.nonTransitiveRClass=true
|
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
|
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
# Please keep each version / library / plugin alphabetized within its own section and subsubsection.
|
# Please keep each version / library / plugin alphabetized within its own section and subsubsection.
|
||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
|
# App version
|
||||||
|
appVersionCode = "1"
|
||||||
|
appVersionName = "2025.7.0"
|
||||||
|
|
||||||
# SDK Versions
|
# SDK Versions
|
||||||
compileSdk = "36"
|
compileSdk = "36"
|
||||||
targetSdk = "36"
|
targetSdk = "36"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user