From a3c72e572c58bf2e8b4243f75ee0642b51f2464d Mon Sep 17 00:00:00 2001 From: Patrick Honkonen <1883101+SaintPatrck@users.noreply.github.com> Date: Wed, 26 Jun 2024 12:19:32 -0400 Subject: [PATCH] [PM-8985] Distribute beta builds on every push to main (#3351) --- .github/workflows/build.yml | 4 ++-- fastlane/Fastfile | 35 ++++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2401555e48..530d9c5a55f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -368,8 +368,8 @@ jobs: bundle exec fastlane run validate_play_store_json_key - name: Publish Play Store bundle - if: ${{ matrix.variant == 'prod' && matrix.artifact == 'aab' && inputs.publish-to-play-store }} - run: bundle exec fastlane publishForInternalTesting + if: ${{ matrix.variant == 'prod' && matrix.artifact == 'aab' && (inputs.publish-to-play-store || github.ref_name == 'main') }} + run: bundle exec fastlane publishBetaToPlayStore publish_fdroid: name: Publish F-Droid artifacts diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 89f75a8652a..321e01cf5d0 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -126,7 +126,26 @@ platform :android do currentVersionName = buildConfigText.match(/versionName = "(.+)"/).captures[0] if options[:versionName].nil? or options[:versionName].to_s.empty? - nextVersionName = currentVersionName + puts "Getting latest version name from previous git tag..." + latestTag = `git tag --sort=committerdate --list | tail -1` + puts "Using previous 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 @@ -193,19 +212,13 @@ platform :android do ) end - desc "Publish PlayStore bundle to Google Play Store Internal testing track" - lane :publishForInternalTesting do - upload_to_play_store( - package_name: "com.x8bit.bitwarden", - track: "internal", - release_status: "draft", - aab: "app/build/outputs/bundle/standardRelease/com.x8bit.bitwarden-standard-release.aab" - ) + desc "Publish Play Store Beta bundle to Google Play Store" + lane :publishBetaToPlayStore do upload_to_play_store( package_name: "com.x8bit.bitwarden.beta", - track: "internal", + track: "Public", release_status: "draft", - aab: "app/build/outputs/bundle/standardBeta/com.x8bit.bitwarden-standard-beta.aab" + aab: "app/build/outputs/bundle/standardBeta/com.x8bit.bitwarden-standard-beta.aab", ) end end