Skip to content

Commit

Permalink
GHA: Wrong parameter passing to fastlane (#5158)
Browse files Browse the repository at this point in the history
Task/Issue URL: 

### Description

### Steps to test this PR

_Feature 1_
- [ ]
- [ ]

### UI changes
| Before  | After |
| ------ | ----- |
!(Upload before screenshot)|(Upload after screenshot)|
  • Loading branch information
malmstein authored Oct 21, 2024
1 parent e7611f6 commit 907ca1d
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release_create_tag.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tag Android Release
name: Release - Create and Push Tag

on:
workflow_dispatch:
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Use fastlane lane to create and push tagged release
id: create_git_tag
run: |
bundle exec fastlane android tag_and_release_version app_version=${{ github.event.inputs.app-version }}
bundle exec fastlane android tag_and_push_release_version app_version:${{ github.event.inputs.app-version }}
- name: Create Asana task when workflow failed
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_create_task.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create Android App Release Task
name: Release - Create Release Task in Asana

on:
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Android App Production Release
name: Release - Android App Production Release

on:
workflow_dispatch:
Expand Down
74 changes: 44 additions & 30 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -236,41 +236,54 @@ platform :android do

end

# Usage - fastlane android tag_and_release_version app_version:0.0.2 release_notes:Testing
# If release notes are not provided, the default ones will be used
desc "Tag and release a new app version"
lane :tag_and_release_version do |options|
options_release_number = options[:app_version]
options_release_notes = options[:release_notes]

releaseNotes = determine_release_notes(releaseNotes: options_release_notes)

update_app_version_and_release_notes(newVersion: options_release_number, newReleaseNotes: releaseNotes)
do_create_and_push_tags(newVersion: options_release_number)
desc "Create a new release branch and update the version"
lane :tag_and_push_release_version do |options|
app_version = options[:app_version]
branch_name = "release/#{app_version}"

# Checkout all branches are available
sh("git fetch")
sh("git checkout main")
sh("git branch")
sh("git submodule update --init --recursive")
sh("git reset --hard")
sh("git clean -f -fxd")

sh("git checkout develop")
sh("git branch")
sh("git submodule update --init --recursive")
sh("git reset --hard")
sh("git clean -f -fxd")

# Create a new release branch
sh("git checkout -b #{branch_name}")

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

end
git_commit(
message: "Updated version number for new release - #{app_version}",
path: "*",
allow_nothing_to_commit: true,
skip_git_hooks: true
)

desc "Updates app version and release notes"
private_lane :update_app_version_and_release_notes do |options|
newVersion = options[:newVersion]
releaseNotes = options[:newReleaseNotes]
sh "git checkout -b release/#{newVersion} develop"
sh "git checkout main"
sh "git merge --no-ff release/#{app_version}"
sh "git tag -a #{app_version} -m #{app_version}"
sh "git checkout develop"
sh "git merge --no-ff release/#{app_version}"
sh "git branch -d release/#{app_version}"

File.open(appVersionFilePath, 'w') do |file|
file.write("VERSION=#{newVersion}")
end
UI.success("Release branch #{branch_name} created successfully!")

File.open(releaseNotesFilePath, 'w') do |file|
file.write("""#{releaseNotes}""")
end
push_git_tags(tag: app_version)
sh "git push origin main"
sh "git push origin develop"

git_commit(
message: "Updated release notes and version number for new release - #{newVersion}",
path: "*",
allow_nothing_to_commit: true,
skip_git_hooks: true
)
end
UI.header("#{app_version} tag has been successfully created. 🎉")
end

# Note, this currently relies on having `git flow` tools installed.
# This dependency could be removed with a little more time to tidy up this script to do the branching/merging manually.
Expand Down Expand Up @@ -340,6 +353,7 @@ platform :android do
skip_git_hooks: true
)

sh "git fetch"
sh "git checkout main"
sh "git merge --no-ff release/#{newVersion}"
sh "git tag -a #{newVersion} -m #{newVersion}"
Expand Down

0 comments on commit 907ca1d

Please sign in to comment.