mirror of
https://github.com/bitwarden/android.git
synced 2025-12-10 08:35:05 -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: |
|
||||
DEFAULT_VERSION_CODE=$GITHUB_RUN_NUMBER
|
||||
VERSION_CODE="${{ inputs.version-code || '$DEFAULT_VERSION_CODE' }}"
|
||||
bundle exec fastlane setAuthenticatorBuildVersionInfo \
|
||||
bundle exec fastlane setBuildVersionInfo \
|
||||
versionCode:$VERSION_CODE \
|
||||
versionName:${{ inputs.version-name || '' }}
|
||||
|
||||
regex='versionName = "([^"]+)"'
|
||||
if [[ "$(cat authenticator/build.gradle.kts)" =~ $regex ]]; then
|
||||
regex='appVersionName = "([^"]+)"'
|
||||
if [[ "$(cat gradle/libs.versions.toml)" =~ $regex ]]; then
|
||||
VERSION_NAME="${BASH_REMATCH[1]}"
|
||||
fi
|
||||
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 \
|
||||
versionName:${{ inputs.version-name || '' }}
|
||||
|
||||
regex='versionName = "([^"]+)"'
|
||||
if [[ "$(cat app/build.gradle.kts)" =~ $regex ]]; then
|
||||
regex='appVersionName = "([^"]+)"'
|
||||
if [[ "$(cat gradle/libs.versions.toml)" =~ $regex ]]; then
|
||||
VERSION_NAME="${BASH_REMATCH[1]}"
|
||||
fi
|
||||
echo "Version Name: ${VERSION_NAME}" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
@ -55,8 +55,8 @@ android {
|
||||
applicationId = "com.x8bit.bitwarden"
|
||||
minSdk = libs.versions.minSdk.get().toInt()
|
||||
targetSdk = libs.versions.targetSdk.get().toInt()
|
||||
versionCode = 1
|
||||
versionName = "2025.7.0"
|
||||
versionCode = libs.versions.appVersionCode.get().toInt()
|
||||
versionName = libs.versions.appVersionName.get()
|
||||
|
||||
setProperty("archivesBaseName", "com.x8bit.bitwarden")
|
||||
|
||||
|
||||
@ -30,8 +30,8 @@ android {
|
||||
applicationId = "com.bitwarden.authenticator"
|
||||
minSdk = libs.versions.minSdkBwa.get().toInt()
|
||||
targetSdk = libs.versions.targetSdk.get().toInt()
|
||||
versionCode = 1
|
||||
versionName = "2025.7.0"
|
||||
versionCode = libs.versions.appVersionCode.get().toInt()
|
||||
versionName = libs.versions.appVersionName.get()
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@ -126,14 +126,14 @@ platform :android do
|
||||
fastlane_require "time"
|
||||
lane :setBuildVersionInfo do |options|
|
||||
|
||||
# Read-in app build config file.
|
||||
buildConfigPath = "../app/build.gradle.kts"
|
||||
buildConfigFile = File.open(buildConfigPath)
|
||||
buildConfigText = buildConfigFile.read
|
||||
buildConfigFile.close
|
||||
# Read-in app toml file.
|
||||
tomlLibraryPath = "../gradle/libs.versions.toml"
|
||||
tomlLibraryFile = File.open(tomlLibraryPath)
|
||||
tomlLibraryText = tomlLibraryFile.read
|
||||
tomlLibraryFile.close
|
||||
|
||||
currentVersionCode = buildConfigText.match(/versionCode = (\d+)/).captures[0]
|
||||
currentVersionName = buildConfigText.match(/versionName = "(.+)"/).captures[0]
|
||||
currentVersionCode = tomlLibraryText.match(/appVersionCode = "(\d+)"/).captures[0]
|
||||
currentVersionName = tomlLibraryText.match(/appVersionName = "(.+)"/).captures[0]
|
||||
|
||||
if options[:versionName].nil? or options[:versionName].to_s.empty?
|
||||
puts "Fetching latest tags from origin..."
|
||||
@ -164,12 +164,12 @@ platform :android do
|
||||
|
||||
# Replace version information.
|
||||
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}."
|
||||
buildConfigText.gsub!("versionName = \"#{currentVersionName}\"", "versionName = \"#{nextVersionName}\"")
|
||||
tomlLibraryText.gsub!("appVersionName = \"#{currentVersionName}\"", "appVersionName = \"#{nextVersionName}\"")
|
||||
|
||||
# Save changes
|
||||
File.open(buildConfigPath, "w") { |buildConfigFile| buildConfigFile << buildConfigText }
|
||||
File.open(tomlLibraryPath, "w") { |tomlLibraryFile| tomlLibraryFile << tomlLibraryText }
|
||||
end
|
||||
|
||||
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}")
|
||||
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"
|
||||
lane :buildAuthenticatorDebug do
|
||||
gradle(
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
android.experimental.enableTestFixturesKotlinSupport=true
|
||||
android.nonTransitiveRClass=true
|
||||
android.useAndroidX=true
|
||||
|
||||
kotlin.code.style=official
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
# Please keep each version / library / plugin alphabetized within its own section and subsubsection.
|
||||
[versions]
|
||||
|
||||
# App version
|
||||
appVersionCode = "1"
|
||||
appVersionName = "2025.7.0"
|
||||
|
||||
# SDK Versions
|
||||
compileSdk = "36"
|
||||
targetSdk = "36"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user