Skip to content

Commit

Permalink
Merge branch 'ifFixes' of github.com:Strauman/exercisebank into ifFixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Strauman committed Nov 13, 2018
2 parents c8d6c4f + c8be569 commit ab4660b
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions releasing/do_release.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env ruby
require_relative 'releaser'
require 'pathname'
require 'inifile'
require 'pp'
# p ARGV[0]
suggest_num_commits=20
# n_commits=3
FPATH=File.dirname(File.expand_path(__FILE__))
def expath relpath
exercisebank_abspath=File.dirname(FPATH)
File.expand_path(File.join(exercisebank_abspath,relpath))
end
ini_path=expath "/src/packaging/texpackvars.ini"
ini_path=File.expand_path(ini_path)
# ini_path="../src/packaging/texpackvars.ini"
myini = IniFile.load(ini_path)
version = myini[:global]['version']
build = myini[:global]['build']
# tag = "#{version}b#{build}-prerelease"
tag = "#{version}b#{build}-experimental"
$current_commit=`git log --pretty=format:'%H' -n 1`
r = Releaser.new(ENV['GH_TOKEN'], tag, 'Strauman/exercisebank')
r.get_release
def make_draft r
if ARGV.include?("-n")
n_commits=ARGV[ARGV.index("-n")+1]
else
$latest_commits=`git log --pretty=format:'%s' -n #{suggest_num_commits}`
$latest_commits = $latest_commits.split("\n")
$latest_commits.map!.with_index{|lc,i| "#{i+1}: #{lc}"}
puts($latest_commits)
print "Number of commit messages to include: "
n_commits=$stdin.gets
end
$current_body=`git log --pretty=format:'%B' -n #{n_commits}`
print $current_body
# exit 0
r.push sha: $current_commit, body: $current_body
r.upload_asset(expath('release/exercisebank.sty'))
r.upload_asset(expath('release/exercisebank-doc.pdf'))
# r.upload_asset('../exercisebank.zip')
end
if ARGV.include?('--delete')
r.get_release
unless r.release.nil?
r.delete
r.get_release!
end
else
if r.release.nil?
make_draft r
elsif ARGV.include?('-f')
r.delete
r.get_release!
make_draft r
end
unless r.release.nil?
if r.release[:draft]
r.publish if ARGV.include?('--publish')
end
end
if r.release[:draft]
p 'DRAFT'
else
p 'NDRAFT'
end
end
pp r.release

0 comments on commit ab4660b

Please sign in to comment.