-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakeFile
71 lines (55 loc) · 1.57 KB
/
RakeFile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require 'rubygems'
require 'albacore'
require 'net/github-upload'
login = `git config github.user`.chomp # your login for github
token = `git config github.token`.chomp # your token for github
repo = $1 if repo.nil? && `git remote show origin` =~ /[email protected]:(.+?)\.git/
repo.chomp!
project = repo.split('/')[1]
tag_name = ENV['TAG']
package_file = "#{project}-#{tag_name}.zip"
gh = Net::GitHub::Upload.new(
:login => login,
:token => token
)
def die_from_lack_of_tag ()
puts "You must provide a TAG=[name]"
exit 1
end
namespace :release do
desc "Build release binaries."
msbuild :build do |msb|
msb.properties :configuration => :Release
msb.targets :Rebuild
msb.solution = "#{project}.sln"
end
desc "Package release image"
zip :package => :build do |zip|
die_from_lack_of_tag unless tag_name
zip.directories_to_zip "#{project}/bin/Release/"
zip.additional_files = "README.markdown"
zip.output_file = package_file
zip.output_path = File.dirname(__FILE__)
end
desc "Tag repository"
task :tag do
die_from_lack_of_tag unless tag_name
`git tag "#{tag_name}"`
`git push origin "#{tag_name}"`
end
desc "Upload release package"
task :upload => :package do
die_from_lack_of_tag unless tag_name
puts("GitHub Repo: #{repo}")
puts("GitHub Login: #{login}")
puts("GitHub Token: #{token}")
gh.upload(
:repos => repo,
:file => package_file,
:description => "Release #{tag_name}"
)
end
desc "Do all release tasks"
task :all => [:tag, :upload] do
end
end