@@ -22,7 +22,7 @@ platform :android do
22
22
UI . user_error! ( "You need to specify a type." ) unless type != nil
23
23
UI . user_error! ( "Type #{ type } is not a valid type (patch/minor/major" ) unless [ "major" , "minor" , "patch" ] . include? type
24
24
25
- # Version handling
25
+ # Compute next version number
26
26
current_version = get_version_name (
27
27
gradle_file_path :"algoliasearch/common.gradle" ,
28
28
ext_constant_name :"PUBLISH_VERSION"
@@ -31,9 +31,12 @@ platform :android do
31
31
version_number = increment_semver ( current_version , type )
32
32
puts "New version: #{ version_number } "
33
33
34
+ # Checkout master
34
35
ensure_git_status_clean ( show_uncommitted_changes :true )
36
+ sh ( "git checkout master" )
37
+ git_pull
35
38
36
- # Changelog handling
39
+ # Generate changelog updates
37
40
changes = sh ( "conventional-changelog --preset angular --output-unreleased" , log :false )
38
41
changes_lines = changes . split ( /\n +/ ) [ 2 ..-1 ] # Remove header
39
42
changes_lines [ 0 ] = "## #{ version_number } "
@@ -45,25 +48,18 @@ platform :android do
45
48
if notest == false
46
49
test ( )
47
50
end
48
- # prepare_git(branch, true)
49
51
52
+ #TODO: Does this make sense if we checkout master on line 36?
50
53
masterHash = sh ( "git rev-parse origin/master" )
51
54
headHash = sh ( "git rev-parse HEAD" )
52
-
53
55
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"
55
57
end
56
58
57
- sh ( "git checkout master" )
58
- sh ( "git stash" )
59
- git_pull
60
- sh ( "git stash pop" )
61
-
62
-
59
+ # Release the new version
63
60
sh ( "cd .. && ./release.sh #{ version_number } " )
64
-
61
+ # Post the changes via GitHub Release API
65
62
post_github_release ( version_number , changes )
66
-
67
63
end
68
64
end
69
65
0 commit comments