Skip to content

Commit

Permalink
[PM-8985] Distribute beta builds on every push to main (#3351)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintPatrck authored Jun 26, 2024
1 parent 159cb02 commit a3c72e5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 24 additions & 11 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit a3c72e5

Please sign in to comment.