Skip to content

Commit

Permalink
Task for updating all releases on GitHub (jjochen#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjochen authored Jan 8, 2018
1 parent fde5491 commit 06a9f29
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ GEM
sqlite3 (~> 1.3)
xcinvoke (~> 0.3.0)
liferaft (0.0.6)
minitest (5.10.3)
minitest (5.11.1)
molinillo (0.5.7)
multi_json (1.12.2)
multipart-post (2.0.0)
Expand All @@ -99,7 +99,7 @@ GEM
retriable (2.1.0)
rouge (1.11.1)
ruby-macho (1.1.0)
sass (3.5.4)
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
Expand Down
30 changes: 29 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,34 @@ begin
release = client.create_release repo, version, options
puts "#{release.name} created."
end

desc 'Update github releases'
task :update_github_releases do
title "Updating releases on github"
repo = "jjochen/JJFloatingActionButton"

client = Octokit::Client.new :access_token => ENV['JJ_GITHUB_TOKEN']
client.releases(repo).each do |release|
puts

url = release.url
puts "url: #{url}"

version = release.tag_name
puts "version: #{version}"

body = changelog_for_version version
puts "body: \n#{body}"

options = {
:name => version,
:body => body
}

release = client.update_release url, options unless body.empty?
puts "#{version} updated."
end
end

rescue LoadError, NameError => e
error_message 'Some Rake tasks haven been disabled because the environment' \
Expand Down Expand Up @@ -340,7 +368,7 @@ def changelog_for_version(version)
in_version = false
f.each_line do |line|
if in_version
if line.match(/^\#\# \[.*/)
if line.match(/^\#\# \[.*/) || line.match(/^\\\* \*.*/)
break
elsif
changelog.concat(line)
Expand Down

0 comments on commit 06a9f29

Please sign in to comment.