Skip to content

Commit e09b939

Browse files
author
Daniel
authored
Automate publishing releases on GitHub (airsidemobile#249)
* Automatically create a release on GitHub * Ignore vi swp files * Add comment to fastfile * Remove vim specifics from gitignore
1 parent 6e301dd commit e09b939

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@ fastlane/test_output
8686

8787
# Sonarqube
8888
.scannerwork
89+

fastlane/Fastfile

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
require 'fileutils'
1+
require "fileutils"
2+
require "tempfile"
23

34
fastlane_version "2.63.0"
45

@@ -162,9 +163,27 @@ lane :release do
162163
# Puplish pod
163164
pod_push(path: "JOSESwift.podspec")
164165

166+
# Publish release
167+
publish_release
168+
165169
ensure_git_status_clean
166170
end
167171

172+
desc "Publishes the release on GitHub"
173+
lane :publish_release do
174+
version = get_version_number(target: "JOSESwift")
175+
176+
changelog = File.read("../CHANGELOG.md")
177+
changes = changelog[/(- .+\(#.+\)\n)+/] # Filter latest change set (e.g. "- Add some feature (#123)\n...").
178+
tmp_changelog = Tempfile.new("jose-changelog")
179+
tmp_changelog.write(changes)
180+
tmp_changelog.close
181+
182+
system("gh release create #{version} --title v#{version} --notes-file #{tmp_changelog.path}")
183+
184+
tmp_changelog.unlink
185+
end
186+
168187
desc "Run Sonarqube analysis after running the test lane"
169188
lane :sonarqube do |options|
170189
unless ENV['FL_SONAR_LOGIN']

0 commit comments

Comments
 (0)