github-release-party 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2556b342ef0042f2bc6cd22748a1dfe0d20c44be
4
- data.tar.gz: f8449fe4310a3f2df8eb7abf9620540269d9184b
3
+ metadata.gz: 004e473ce8b4be868b8dfc3e6d9d077a22225ae0
4
+ data.tar.gz: 61404a8f2907d6974e656282b532ed24138cdd96
5
5
  SHA512:
6
- metadata.gz: 5b767526deeb201ea12fde6ebf84fbfe15e1c299ed04093d752d050e10a361449efd5160bb298cf1182d080ea03146599336d22409e6519c263b0793b8ecc3ef
7
- data.tar.gz: 12d9d3822c14a039fbcca5d46f346aad8caaefcfc9dc8d732f0b4c6ae452dd833161281841357874b72705dcec8843eb994d3b1759da545cdf9c82cebc2f9d51
6
+ metadata.gz: 368ca7b60b996e354506f3671021b24a0b009d7a96d66f2cd664b90d28b83f4dcc0101feb66390e522e8984655bea0b503543d1dd09b5bfc943051270b346f6b
7
+ data.tar.gz: 15d9d75e979947714cbc289686b01702352f4c9a4f95af7bf6cf4f59f2ff96244693ecb4c9beb00e6fc87ec551b5fbb48cf3898e106efda90d63d81322f4d543
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,102 +1,120 @@
1
+ require "open3"
1
2
  require "github-release-party"
2
3
 
3
- desc "Deploy new version to Heroku"
4
- task :deploy do
5
- abort unless GithubReleaseParty.env_ok
6
- success = system "git push heroku HEAD:master"
7
- if not success
8
- abort "Deploy failed."
4
+ def heroku_push(args=[])
5
+ # grab the new version number from the Heroku push output
6
+ cmd = %w[git push heroku HEAD:master] + args
7
+ ver = Open3.popen2e(*cmd) do |stdin, output, thread|
8
+ v = nil
9
+ output.each do |line|
10
+ puts line
11
+ if /Released (v\d+)/ =~ line
12
+ v = $~[1]
13
+ end
14
+ end
15
+ v
9
16
  end
10
- Rake.application.invoke_task("deploy:tag")
17
+ return ver
18
+ end
19
+
20
+ def github_tag(hash, ver)
21
+ # build tag message
22
+ repo = GithubReleaseParty.repo
23
+ tag_name = "heroku/#{ver}"
24
+ last_tag = `git describe --tags --abbrev=0 --match 'heroku/v*' 2> /dev/null`.strip
25
+ if last_tag.empty?
26
+ # first deploy, use root hash
27
+ last_tag = `git rev-list --max-parents=0 HEAD`.strip[0..6]
28
+ first_deploy = true
29
+ end
30
+ commits = `git log #{last_tag}..#{hash} --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
31
+ message = "Deploy #{hash[0..6]}\n\nDiff: https://github.com/#{repo}/compare/#{last_tag}...#{tag_name}\n#{commits}"
32
+
33
+ if first_deploy
34
+ message = "#{message.strip}\n"+`git show #{last_tag} -s --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
35
+ end
36
+
37
+ # tag and push new tag
38
+ puts "Tagging #{tag_name}."
39
+ success = system "git tag -a -m \"#{message.gsub('"','\\"')}\" #{tag_name} #{hash}"
40
+ abort if not success
41
+ success = system "git push origin #{tag_name}"
42
+ abort if not success
43
+
44
+ # create GitHub release
45
+ puts
46
+ puts "Waiting 3 seconds to let GitHub process the new tag."
47
+ sleep 3
48
+ GithubReleaseParty.create(tag_name, ver, message)
49
+ end
50
+
51
+
52
+ desc "Deploy a new version to Heroku"
53
+ task :deploy do
54
+ abort if not GithubReleaseParty.env_ok
55
+ ver = heroku_push() or abort("Deploy failed.")
56
+ hash = `git rev-parse HEAD`.strip
57
+ github_tag(hash, ver)
11
58
  end
12
59
 
13
60
  namespace :deploy do
14
- desc "Forcibly deploy new version to Heroku"
61
+ desc "Deploy a new version to Heroku using --force"
15
62
  task :force do
16
- abort unless GithubReleaseParty.env_ok
17
- success = system "git push heroku HEAD:master --force"
18
- if not success
19
- abort "Deploy failed."
20
- end
21
- Rake.application.invoke_task("deploy:tag")
63
+ abort if not GithubReleaseParty.env_ok
64
+ ver = heroku_push(%w[--force]) or abort("Deploy failed.")
65
+ hash = `git rev-parse HEAD`.strip
66
+ github_tag(hash, ver)
22
67
  end
23
68
 
24
- desc "Tag latest release"
69
+ desc "Tag last release"
25
70
  task :tag do
26
- abort unless GithubReleaseParty.env_ok
71
+ abort if not GithubReleaseParty.env_ok
27
72
 
28
73
  # get heroku version number
29
74
  begin
30
75
  heroku_app = `git remote -v`.scan(/^heroku\t.*heroku\.com[:\/](.+)\.git /).uniq.flatten.first
31
76
  ver = `heroku releases --app '#{heroku_app}'`.split("\n")[1].split(" ")[0]
32
77
  hash = `git rev-parse HEAD`.strip
33
- tag_name = "heroku/#{ver}"
34
78
  rescue
35
79
  abort "There was a problem getting the release number. Have you logged in with the Heroku cli? Try again with 'rake deploy:tag'."
36
80
  end
37
81
 
38
- # build tag message
82
+ github_tag(hash, ver)
83
+ end
84
+
85
+ desc "Rebuild all the release tags"
86
+ task :retag do
87
+ github = GithubReleaseParty.new
39
88
  repo = GithubReleaseParty.repo
40
- last_tag = `git describe --tags --abbrev=0 --match 'heroku/v*' 2> /dev/null`.strip
41
- if last_tag.empty?
42
- # first deploy, use root hash
43
- last_tag = `git rev-list --max-parents=0 HEAD`.strip[0..6]
44
- first_deploy = true
45
- end
46
- commits = `git log #{last_tag}..#{hash} --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
47
- message = "Deploy #{hash[0..6]}\n\nDiff: https://github.com/#{repo}/compare/#{last_tag}...#{tag_name}\n#{commits}"
48
89
 
49
- if first_deploy
50
- message = "#{message.strip}\n"+`git show #{last_tag} -s --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
51
- end
90
+ tags = `git tag -l heroku/v* --sort=version:refname`.split("\n")
91
+ puts "Found #{tags.count} tags."
92
+ tags.each_with_index do |tag_name, i|
93
+ ver = tag_name[/v(\d+)/]
94
+ last_tag = if i == 0
95
+ `git rev-list --max-parents=0 HEAD`.strip
96
+ else
97
+ tags[i-1]
98
+ end
52
99
 
53
- # tag and push new tag
54
- puts "Tagging #{tag_name}."
55
- success = system "git tag -a -m \"#{message.gsub('"','\\"')}\" #{tag_name} #{hash}"
56
- abort if not success
57
- success = system "git push origin #{tag_name}"
58
- abort if not success
59
-
60
- # create GitHub release
61
- puts
62
- puts "Waiting 3 seconds to let GitHub process the new tag."
63
- sleep 3
64
- GithubReleaseParty.create(tag_name, ver, message)
65
- end
66
- end
67
-
68
- desc "Rebuild all the release tags"
69
- task :retag do
70
- github = GithubReleaseParty.new
71
- repo = GithubReleaseParty.repo
100
+ hash = `git rev-list --max-count=1 #{tag_name}`.strip
101
+ date = `git show --pretty="format:%ai" -s --no-color #{tag_name} | tail -1`.strip
102
+ commits = `git log #{last_tag}..#{tag_name} --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
103
+ message = "Deploy #{hash[0..6]}\n\nDiff: https://github.com/#{repo}/compare/#{last_tag}...#{tag_name}\n#{commits}"
72
104
 
73
- tags = `git tag -l heroku/v* --sort=version:refname`.split("\n")
74
- puts "Found #{tags.count} tags."
75
- tags.each_with_index do |tag_name, i|
76
- ver = tag_name[/v(\d+)/]
77
- last_tag = if i == 0
78
- `git rev-list --max-parents=0 HEAD`.strip
79
- else
80
- tags[i-1]
81
- end
105
+ if i == 0
106
+ message += "\n"+`git show #{last_tag} -s --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
107
+ end
82
108
 
83
- hash = `git rev-list --max-count=1 #{tag_name}`.strip
84
- date = `git show --pretty="format:%ai" -s --no-color #{tag_name} | tail -1`.strip
85
- commits = `git log #{last_tag}..#{tag_name} --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
86
- message = "Deploy #{hash[0..6]}\n\nDiff: https://github.com/#{repo}/compare/#{last_tag}...#{tag_name}\n#{commits}"
109
+ success = system "GIT_COMMITTER_DATE='#{date}' git tag -f -a -m \"#{message.gsub('"','\\"')}\" #{tag_name} #{tag_name}^{}"
110
+ abort if not success
111
+ success = system "git push -f origin #{tag_name}"
112
+ abort if not success
87
113
 
88
- if i == 0
89
- message += "\n"+`git show #{last_tag} -s --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
114
+ # update or create GitHub release
115
+ github.update_or_create(tag_name, ver, message)
90
116
  end
91
117
 
92
- success = system "GIT_COMMITTER_DATE='#{date}' git tag -f -a -m \"#{message.gsub('"','\\"')}\" #{tag_name} #{tag_name}^{}"
93
- abort if not success
94
- success = system "git push -f origin #{tag_name}"
95
- abort if not success
96
-
97
- # update or create GitHub release
98
- github.update_or_create(tag_name, ver, message)
118
+ puts "Done"
99
119
  end
100
-
101
- puts "Done"
102
120
  end
@@ -1,3 +1,3 @@
1
1
  class GithubReleaseParty
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-release-party
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Sundin
@@ -12,26 +12,26 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDjjCCAnagAwIBAgIBATANBgkqhkiG9w0BAQUFADBGMREwDwYDVQQDDAhydWJ5
14
14
  Z2VtczEcMBoGCgmSJomT8ixkARkWDHN0ZWZhbnN1bmRpbjETMBEGCgmSJomT8ixk
15
- ARkWA2NvbTAeFw0xNTA2MjgxOTA4MDRaFw0xNjA2MjcxOTA4MDRaMEYxETAPBgNV
15
+ ARkWA2NvbTAeFw0xNjEyMjUwNjE1MjVaFw0yNjEyMjMwNjE1MjVaMEYxETAPBgNV
16
16
  BAMMCHJ1YnlnZW1zMRwwGgYKCZImiZPyLGQBGRYMc3RlZmFuc3VuZGluMRMwEQYK
17
17
  CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
18
- zaC2OyN2Ek6mSG8Kgkpmd43u/R/qRXPL/6KlVwFEC85lkxA7Sz+cma5zb61OsxqG
19
- +QxExOi/NqxC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heYRa0OO
28
- KklsOCmNfv+azLGUFewp5NgqHRSv5IUo+Hu2reswG14w/qE6pLjoPAyiSIbTwQZA
29
- ddC8/f/S/IXQR8CE+lL51iMWvuoW9uwTBHkGcrdziaeex8cfD2P6qVYTgiQ73uH2
30
- 7+ics/PdwNmGDBGzFHlToo5PPMMSMdkmudsICMSpOEeMaqmycm1wX2OiZ/lnZSwm
31
- om8ywtenW15x7BAdGyxJu5GG405l/m+Acfg2+dLqNme8av1YIJcKAchwWzE5/EvH
32
- PiU=
26
+ ZWZhbnN1bmRpbi5jb20wDQYJKoZIhvcNAQEFBQADggEBAJWwHS8TyssFdfejrrUq
27
+ kpP0smaCG0hkfD5+xp29HIu4VPyQZIju4DnlnUcj8jCYrJXCwBe6nyx5WAPG3ZIY
28
+ TzwSKVajyJbfgB4NcIE8qSLktx+PgWigqlYQzioqMLNMDpxw558OyGRuEr5hItnN
29
+ SRG/mEUFyjtyl8YS7o5QnSQlR+ZPlOURsKxHsGH0oQtN1EXRpyYWoaCIYT9wfuwY
30
+ shCB2umA9buEFZkDDXDLn+xe8+ZwJHUngtkB6/T8yLUeqpwnVzaPTnhJJstYpxaa
31
+ E04BZKo2WzOTzSDymo97Yu4YFgyc98umMyeaCvPk4YmdNzqSanAXpY2bnsyu0CF5
32
+ Td0=
33
33
  -----END CERTIFICATE-----
34
- date: 2016-03-16 00:00:00.000000000 Z
34
+ date: 2016-12-25 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: httparty
@@ -51,16 +51,16 @@ dependencies:
51
51
  name: rake
52
52
  requirement: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ">="
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: 11.1.0
56
+ version: '12'
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ">="
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: 11.1.0
63
+ version: '12'
64
64
  description: I use this gem to automatically create GitHub releases when I deploy
65
65
  to Heroku. See the GitHub page for usage.
66
66
  email:
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: 1.3.6
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.5.1
95
+ rubygems_version: 2.5.2
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Easily create GitHub releases.
metadata.gz.sig CHANGED
Binary file