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

Commit 4091d39

Browse files
committed
feat(deploy): post GitHub release
1 parent af9e2bc commit 4091d39

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

fastlane/Fastfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,29 @@ platform :android do
4949

5050
masterHash = sh("git rev-parse origin/master")
5151
headHash = sh("git rev-parse HEAD")
52-
53-
if masterHash != headHash
52+
53+
if masterHash != headHash
5454
#raise "Error: Master and Head Hashes do not match, meaning that we are probably not on Master and therefore can't deploy"
5555
end
5656

5757
sh("git checkout master")
5858
sh("git stash")
5959
git_pull
6060
sh("git stash pop")
61-
61+
6262

6363
sh("cd .. && ./release.sh #{version_number}")
6464

65-
#post_github_release(version_number, changes)
65+
post_github_release(version_number, changes)
6666

6767
end
6868
end
6969

7070
def prepare_git(branch, ensure_clean=true)
7171
masterHash = sh("git rev-parse origin/master")
7272
headHash = sh("git rev-parse HEAD")
73-
74-
if masterHash != headHash
73+
74+
if masterHash != headHash
7575
raise "Error: Master and Head Hashes do not match, meaning that we are probably not on Master and therefore can't deploy"
7676
end
7777
sh("git checkout master")
@@ -95,3 +95,9 @@ def file_edit(filename, regexp, replacement)
9595
FileUtils.mv tempfile.path, filename
9696
end
9797
end
98+
99+
def post_github_release(version, changes, token=ENV['GITHUB_TOKEN'])
100+
release_changes = changes.gsub(/^## #{version} /m, "## ").gsub("\n", "\\n")
101+
json=%Q[{"tag_name": "#{version}","target_commitish": "master","name": "#{version}","body": "#{release_changes}","draft": false,"prerelease": false}]
102+
sh(%{curl --data '#{json}' https://api.github.com/repos/algolia/instantsearch-android/releases?access_token=#{token}})
103+
end

0 commit comments

Comments
 (0)