Skip to content
This repository was archived by the owner on Jan 31, 2022. It is now read-only.

Commit 0e6fcd1

Browse files
committed
chore(fastlane): Cleanup deploy script, avoid useless stash
1 parent 8a46eed commit 0e6fcd1

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

fastlane/Fastfile

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ platform :android do
2222
UI.user_error!("You need to specify a type.") unless type != nil
2323
UI.user_error!("Type #{type} is not a valid type (patch/minor/major") unless ["major","minor","patch"].include? type
2424

25-
# Version handling
25+
# Compute next version number
2626
current_version = get_version_name(
2727
gradle_file_path:"algoliasearch/common.gradle",
2828
ext_constant_name:"PUBLISH_VERSION"
@@ -31,9 +31,12 @@ platform :android do
3131
version_number = increment_semver(current_version, type)
3232
puts "New version: #{version_number}"
3333

34+
# Checkout master
3435
ensure_git_status_clean(show_uncommitted_changes:true)
36+
sh("git checkout master")
37+
git_pull
3538

36-
# Changelog handling
39+
# Generate changelog updates
3740
changes = sh("conventional-changelog --preset angular --output-unreleased", log:false)
3841
changes_lines = changes.split(/\n+/)[2..-1] # Remove header
3942
changes_lines[0] = "## #{version_number}"
@@ -45,25 +48,18 @@ platform :android do
4548
if notest == false
4649
test()
4750
end
48-
# prepare_git(branch, true)
4951

52+
#TODO: Does this make sense if we checkout master on line 36?
5053
masterHash = sh("git rev-parse origin/master")
5154
headHash = sh("git rev-parse HEAD")
52-
5355
if masterHash != headHash
54-
#raise "Error: Master and Head Hashes do not match, meaning that we are probably not on Master and therefore can't deploy"
56+
raise "Error: master and HEAD hashes do not match, meaning that we are probably not on master and therefore can't deploy"
5557
end
5658

57-
sh("git checkout master")
58-
sh("git stash")
59-
git_pull
60-
sh("git stash pop")
61-
62-
59+
# Release the new version
6360
sh("cd .. && ./release.sh #{version_number}")
64-
61+
# Post the changes via GitHub Release API
6562
post_github_release(version_number, changes)
66-
6763
end
6864
end
6965

0 commit comments

Comments
 (0)