Skip to content

Commit

Permalink
Merge pull request #3948 from wikimedia/improve_release_notes
Browse files Browse the repository at this point in the history
Add pull requests info to Test Flight
  • Loading branch information
tonisevener committed Jun 1, 2021
2 parents 638188d + fe64f06 commit 9f5b29e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
32 changes: 23 additions & 9 deletions fastlane/Fastfile
Expand Up @@ -180,7 +180,7 @@ platform :ios do
)
end

desc "Add a tag for the current build number and push to repo."
desc "Add a build tag for the current build number and push to repo. While this tags a build, tag_release sets a release tag."
lane :tag do |options|
prefix = options[:prefix] || "betas"
build_number = options[:build_number] || options[:build] || get_build_number
Expand All @@ -189,7 +189,7 @@ platform :ios do
sh "git push origin --tags"
end

desc "Add a release tag for the latest beta and push to repo."
desc "Add a release tag for the latest beta and push to repo. For tagging non-releases, use `tag`."
lane :tag_release do |options|
specified_build = options[:build_tag]
if specified_build.nil? || specified_build.empty?
Expand All @@ -211,7 +211,7 @@ platform :ios do
)
end

desc "Build the app for distibution"
desc "Build the app for distribution"
lane :build do |options|
project_dir = ".."
build_dir = "../build"
Expand All @@ -228,20 +228,28 @@ platform :ios do
sh "xcodebuild -exportArchive -exportOptionsPlist ExportOptions.plist -archivePath \"#{build_dir}/#{product_name}.xcarchive\" -exportPath \"#{build_dir}\""
end

desc "Pushes the production app to TestFlight and tags the release. Only releases to internal testers."
desc "Pushes the production app to TestFlight and tags the release. Only releases to internal testers. (This is very similar to `push_production`, although this command also tags the build in git.)"
lane :deploy do |options|
tag_prefix = "betas"
build = options[:build] || get_latest_build_number(prefix: tag_prefix) + 1
push_production(build: build)
last_build = get_latest_build_number(prefix: tag_prefix)
build = options[:build] || last_build + 1

merges_since_last_build = get_recent_commits(start: "betas/#{last_build}")
last_public_release = get_latest_tag_with_prefix(prefix: "releases/")[0..-2]
merges_since_last_release = get_recent_commits(start: last_public_release)
changelog = "____New since last build (#{tag_prefix}/#{last_build})____\n#{merges_since_last_build.empty? ? 'None' : merges_since_last_build}\n\n" +
"____New since last public release (#{last_public_release})____\n#{merges_since_last_release.empty? ? 'None' : merges_since_last_release}"
push_production(build: build, changelog: changelog)
tag(prefix: tag_prefix, build_number: build)
end

desc "updates version, builds, and pushes the production build to TestFlight. Only releases to internal testers."
desc "Updates version, builds, and pushes the production build to TestFlight. Only releases to internal testers."
lane :push_production do |options|
push(
product_name: "Wikipedia",
app_identifier: "org.wikimedia.wikipedia",
build: options[:build]
build: options[:build],
changelog: options[:changelog]
)
end

Expand Down Expand Up @@ -277,6 +285,11 @@ platform :ios do
get_latest_tag_with_prefix(prefix: prefix)[prefix.length..-1].to_i
end

lane :get_recent_commits do |options|
start = options[:start] || "HEAD"
`git log #{start}..HEAD --merges --first-parent main --grep="Merge branch 'main' into" --invert-grep --pretty=format:"%h - %b (%s)" | sed 's/Merge pull request //g'`
end

desc "updates version, builds, and pushes to TestFlight"
lane :push do |options|
build_dir = "build"
Expand Down Expand Up @@ -319,7 +332,8 @@ platform :ios do
skip_submission: true,
distribute_external: false,
app_identifier: app_identifier,
beta_app_feedback_email: "mobile-ios-wikipedia@wikimedia.org"
beta_app_feedback_email: "mobile-ios-wikipedia@wikimedia.org",
changelog: options[:changelog]
)
end

Expand Down
9 changes: 7 additions & 2 deletions fastlane/README.md
Expand Up @@ -80,12 +80,12 @@ Increment the app version major
```
fastlane ios tag
```
Add a release tag for the latest beta and push to repo.
Add a build tag for the current build number and push to repo. While this tags a build, tag_release sets a release tag.
### ios tag_release
```
fastlane ios tag_release
```
Add a release tag for the latest beta and push to repo.
Add a release tag for the latest beta and push to repo. For tagging non-releases, use `tag`.
### ios build
```
fastlane ios build
Expand Down Expand Up @@ -121,6 +121,11 @@ fastlane ios get_latest_tag_with_prefix
fastlane ios get_latest_build_number
```

### ios get_recent_commits
```
fastlane ios get_recent_commits
```

### ios push
```
fastlane ios push
Expand Down

0 comments on commit 9f5b29e

Please sign in to comment.