Skip to content

Commit c600d4d

Browse files
authored
Release/0.0.1 (duckduckgo#5159)
Task/Issue URL: ### Description ### Steps to test this PR _Feature 1_ - [ ] - [ ] ### UI changes | Before | After | | ------ | ----- | !(Upload before screenshot)|(Upload after screenshot)|
1 parent 3421f48 commit c600d4d

3 files changed

Lines changed: 64 additions & 27 deletions

File tree

‎.github/workflows/release_create_tag.yml‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,4 @@ jobs:
3535
- name: Use fastlane lane to create and push tagged release
3636
id: create_git_tag
3737
run: |
38-
bundle exec fastlane android tag_and_release_version app_version=${{ github.event.inputs.app-version }}
39-
40-
- name: Create Asana task when workflow failed
41-
if: ${{ failure() }}
42-
id: create-failure-task
43-
uses: duckduckgo/native-github-asana-sync@v1.1
44-
with:
45-
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
46-
asana-project: ${{ vars.GH_ANDROID_APP_PROJECT_ID }}
47-
asana-section: ${{ vars.GH_ANDROID_APP_INCOMING_SECTION_ID }}
48-
asana-task-name: GH Workflow Failure - Tag Android Release
49-
asana-task-description: Tag Android Release has failed. See https://github.com/duckduckgo/Android/actions/runs/${{ github.run_id }}
50-
action: 'create-asana-task'
38+
bundle exec fastlane android tag_and_push_release_version app_version:"${{ github.event.inputs.app-version }}"

‎fastlane/Fastfile‎

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
releaseNotesDefault = "Bug fixes and other improvements"
1818
releaseNotesBodyHeader = "What's new:"
1919
releaseNotesFileBody = "../app/version/release-notes"
20-
appVersionFilePath = "../app/version/version-properties"
20+
appVersionFilePath = "../app/version/version.properties"
2121
releaseNotesLocales= ["en-US", "en-GB", "en-CA"]
2222
releaseNotesMaxLength = 500
2323
errorMessageCancelled = "Release cancelled 😢"
@@ -233,43 +233,76 @@ platform :android do
233233
releaseNotesLocales.each do |locale|
234234
sh("rm '../fastlane/metadata/android/#{locale}/changelogs/#{flversion}.txt'")
235235
end
236+
end
237+
238+
desc "Create a new release branch and update the version"
239+
lane :tag_and_push_release_version do |options|
240+
app_version = options[:app_version]
241+
242+
UI.message("App version for fastlane is #{app_version}.")
243+
244+
# Define the branch name
245+
branch_name = "release/#{app_version}"
246+
247+
# Create a new release branch
248+
sh("git checkout -b #{branch_name}")
236249

250+
File.open(appVersionFilePath, 'w') do |file|
251+
file.write("VERSION=#{app_version}")
237252
end
238253

254+
git_commit(
255+
message: "Updated version number for new release - #{app_version}",
256+
path: "*",
257+
allow_nothing_to_commit: true,
258+
skip_git_hooks: true
259+
)
260+
261+
sh "git checkout main"
262+
sh "git merge --no-ff release/#{app_version}"
263+
sh "git tag -a #{app_version} -m #{app_version}"
264+
sh "git checkout develop"
265+
sh "git merge --no-ff release/#{app_version}"
266+
sh "git branch -d release/#{app_version}"
267+
268+
UI.success("Release branch #{branch_name} created successfully!")
269+
270+
push_git_tags(tag: app_version)
271+
sh "git push origin main"
272+
sh "git push origin develop"
273+
274+
UI.header("#{app_version} tag has been successfully created. 🎉")
275+
end
276+
239277
# Usage - fastlane android tag_and_release_version app_version:0.0.2 release_notes:Testing
240278
# If release notes are not provided, the default ones will be used
241279
desc "Tag and release a new app version"
242280
lane :tag_and_release_version do |options|
243281
options_release_number = options[:app_version]
244-
options_release_notes = options[:release_notes]
245282

246-
releaseNotes = determine_release_notes(releaseNotes: options_release_notes)
283+
UI.message("Release number = #{options_release_number}")
247284

248-
update_app_version_and_release_notes(newVersion: options_release_number, newReleaseNotes: releaseNotes)
285+
update_app_version(releaseNumber: options_release_number)
249286
do_create_and_push_tags(newVersion: options_release_number)
250287

251288
end
252289

253290
desc "Updates app version and release notes"
254-
private_lane :update_app_version_and_release_notes do |options|
255-
newVersion = options[:newVersion]
256-
releaseNotes = options[:newReleaseNotes]
257-
sh "git checkout -b release/#{newVersion} develop"
291+
private_lane :update_app_version do |options|
292+
newVersion = options[:releaseNumber]
293+
sh "git checkout -b release/'#{newVersion}' develop"
258294

259295
File.open(appVersionFilePath, 'w') do |file|
260296
file.write("VERSION=#{newVersion}")
261297
end
262298

263-
File.open(releaseNotesFilePath, 'w') do |file|
264-
file.write("""#{releaseNotes}""")
265-
end
266-
267299
git_commit(
268-
message: "Updated release notes and version number for new release - #{newVersion}",
300+
message: "Updated version number for new release - #{newVersion}",
269301
path: "*",
270302
allow_nothing_to_commit: true,
271303
skip_git_hooks: true
272304
)
305+
273306
end
274307

275308
# Note, this currently relies on having `git flow` tools installed.
@@ -319,7 +352,7 @@ platform :android do
319352
private_lane :do_create_release_branch do |options|
320353
newVersion = options[:newVersion]
321354
releaseNotes = options[:releaseNotes]
322-
sh "git checkout -b release/#{newVersion} develop"
355+
sh "git checkout -b release/'#{newVersion}' develop"
323356

324357
File.open('../app/version/version.properties', 'w') do |file|
325358
file.write("VERSION=#{newVersion}")

‎fastlane/README.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ Upload APK to Play Store internal testing track
5555

5656
Deploy APK to GitHub
5757

58+
### android tag_and_push_release_version
59+
60+
```sh
61+
[bundle exec] fastlane android tag_and_push_release_version
62+
```
63+
64+
Create a new release branch and update the version
65+
66+
### android tag_and_release_version
67+
68+
```sh
69+
[bundle exec] fastlane android tag_and_release_version
70+
```
71+
72+
Tag and release a new app version
73+
5874
### android release
5975

6076
```sh

0 commit comments

Comments
 (0)