github-release-party 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -1
- data/lib/github-release-party/tasks/fly.rb +129 -0
- data/lib/github-release-party/tasks/heroku.rb +3 -4
- data/lib/github-release-party/version.rb +1 -1
- data/lib/github-release-party.rb +4 -4
- data.tar.gz.sig +0 -0
- metadata +6 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5daa687ea156f731f143bce3dc98a1fcc4a07464a793eb475f1b8d7ba55acc6
|
4
|
+
data.tar.gz: c75ed78a66ceff740603553d0ef81a2d6874d17ffefa63faf60ea7351f223b9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 641bd4382b4c0e3974e12b218dd75099afc3bb2b8bfb651d750c4ce6f486060f9c6c8aae8570435209431766340f8d282660e8d7c9a0e46429f7202528bc1c65
|
7
|
+
data.tar.gz: edcd80c9993c93c0f0f95ae6fedfb2b33cfefa67e4fbe8a5233dfcab12e5473066a54312414624ec7bb7b3b9e705819fd016a78d7f9d2a2bd21d32007e628e85
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
�0C�ԝ�J�˽�zm}E�C�rInW�O��0�i�%/��CA�)�Hp�\�#'v���@�ӹ���sϣ�'S�|�*Q<h}}�C�p?ȇ 8*�q�ܝ��wI�oV�@����SG�퀘.H۪�������f����&�y���r�\�=��z�)��u��y��c&Z�ZE�/��y��z
|
2
|
+
kuI��X��V� ����{�����/�fR.~%i�ש��P���O�i��&�W�B��+��8!
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require "open3"
|
2
|
+
require "shellwords"
|
3
|
+
require "github-release-party"
|
4
|
+
|
5
|
+
def fly_deploy(args=[])
|
6
|
+
# grab the new version number from the "fly deploy" output
|
7
|
+
cmd = %w[fly deploy] + args
|
8
|
+
ver = Open3.popen2e(*cmd) do |stdin, output, thread|
|
9
|
+
v = nil
|
10
|
+
output.each do |line|
|
11
|
+
puts line
|
12
|
+
if /--> release (v\d+) created/ =~ line
|
13
|
+
v = $~[1]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
v
|
17
|
+
end
|
18
|
+
return ver
|
19
|
+
end
|
20
|
+
|
21
|
+
def github_tag(hash, ver)
|
22
|
+
# build tag message
|
23
|
+
repo = GithubReleaseParty.repo
|
24
|
+
tag_name = "fly/#{ver}"
|
25
|
+
last_tag = `git describe --tags --abbrev=0 --match 'fly/v*' 2> /dev/null`.strip
|
26
|
+
if last_tag.empty?
|
27
|
+
# first deploy, use root hash
|
28
|
+
last_tag = `git rev-list --max-parents=0 HEAD`.strip[0..6]
|
29
|
+
first_deploy = true
|
30
|
+
end
|
31
|
+
commits = `git log #{last_tag}..#{hash} --reverse --first-parent --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
|
32
|
+
message = "Deploy #{hash[0..6]}\n\nDiff: https://github.com/#{repo}/compare/#{last_tag}...#{tag_name}\n#{commits}"
|
33
|
+
|
34
|
+
if first_deploy
|
35
|
+
message = "#{message.strip}\n"+`git show #{last_tag} -s --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
|
36
|
+
end
|
37
|
+
|
38
|
+
# tag and push new tag
|
39
|
+
puts
|
40
|
+
puts "Tagging #{tag_name}."
|
41
|
+
success = system "git tag -a -m #{Shellwords.shellescape(message)} #{tag_name} #{hash}"
|
42
|
+
abort if not success
|
43
|
+
puts
|
44
|
+
success = system "git push origin #{tag_name}"
|
45
|
+
abort if not success
|
46
|
+
|
47
|
+
# create GitHub release
|
48
|
+
puts
|
49
|
+
puts "Waiting 3 seconds to let GitHub process the new tag."
|
50
|
+
sleep(3)
|
51
|
+
GithubReleaseParty.create(tag_name, message)
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
desc "Deploy a new version to Fly"
|
56
|
+
task :deploy do
|
57
|
+
GithubReleaseParty.check_env!
|
58
|
+
ver = fly_deploy() or abort("Deploy failed.")
|
59
|
+
hash = `git rev-parse HEAD`.strip
|
60
|
+
github_tag(hash, ver)
|
61
|
+
end
|
62
|
+
|
63
|
+
namespace :deploy do
|
64
|
+
desc "Tag last release"
|
65
|
+
task :tag do
|
66
|
+
GithubReleaseParty.check_env!
|
67
|
+
|
68
|
+
# get fly version number
|
69
|
+
begin
|
70
|
+
fly_releases = JSON.parse(`fly releases --json`)
|
71
|
+
ver = fly_releases[0]["Version"]
|
72
|
+
hash = `git rev-parse HEAD`.strip
|
73
|
+
rescue
|
74
|
+
abort "There was a problem getting the release number. Have you logged in with flyctl? Try again with 'rake deploy:tag'."
|
75
|
+
end
|
76
|
+
|
77
|
+
github_tag(hash, ver)
|
78
|
+
end
|
79
|
+
|
80
|
+
desc "Rebuild all the release tags"
|
81
|
+
task :retag do
|
82
|
+
GithubReleaseParty.check_env!
|
83
|
+
releases = GithubReleaseParty.releases
|
84
|
+
repo = GithubReleaseParty.repo
|
85
|
+
|
86
|
+
tags = `git tag -l fly/v* --sort=version:refname`.split("\n")
|
87
|
+
puts "Found #{tags.length} tags."
|
88
|
+
tags.each_with_index do |tag_name, i|
|
89
|
+
puts
|
90
|
+
last_tag = if i == 0
|
91
|
+
`git rev-list --max-parents=0 HEAD`.strip
|
92
|
+
else
|
93
|
+
tags[i-1]
|
94
|
+
end
|
95
|
+
|
96
|
+
hash = `git rev-list --max-count=1 #{tag_name}`.strip
|
97
|
+
date = `git show --pretty="format:%ai" -s --no-color #{tag_name} | tail -1`.strip
|
98
|
+
commits = `git log #{last_tag}..#{tag_name} --reverse --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
|
99
|
+
message = "Deploy #{hash[0..6]}\n\nDiff: https://github.com/#{repo}/compare/#{last_tag}...#{tag_name}\n#{commits}"
|
100
|
+
|
101
|
+
if i == 0
|
102
|
+
message += "\n"+`git show #{last_tag} -s --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
|
103
|
+
end
|
104
|
+
|
105
|
+
success = system "GIT_COMMITTER_DATE='#{date}' git tag -f -a -m #{Shellwords.shellescape(message)} #{tag_name} #{tag_name}^{}"
|
106
|
+
abort if not success
|
107
|
+
success = system "git push -f origin #{tag_name}"
|
108
|
+
abort if not success
|
109
|
+
|
110
|
+
# update or create GitHub release
|
111
|
+
release = releases.find { |rel| rel["tag_name"] == tag_name }
|
112
|
+
if release
|
113
|
+
GithubReleaseParty.update(release["id"], tag_name, message)
|
114
|
+
else
|
115
|
+
GithubReleaseParty.create(tag_name, message)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
puts
|
120
|
+
puts "Done"
|
121
|
+
end
|
122
|
+
|
123
|
+
desc "List the new commits since last deploy (you might want to pull first to ensure you have the latest tag)"
|
124
|
+
task :changes do
|
125
|
+
last_tag = `git describe --tags --abbrev=0 --match 'fly/v*' 2> /dev/null`.strip
|
126
|
+
last_tag = `git rev-list --max-parents=0 HEAD`.strip[0..6] if last_tag.empty?
|
127
|
+
system "git log --oneline --no-decorate --reverse #{last_tag}..HEAD"
|
128
|
+
end
|
129
|
+
end
|
@@ -48,7 +48,7 @@ def github_tag(hash, ver)
|
|
48
48
|
puts
|
49
49
|
puts "Waiting 3 seconds to let GitHub process the new tag."
|
50
50
|
sleep(3)
|
51
|
-
GithubReleaseParty.create(tag_name,
|
51
|
+
GithubReleaseParty.create(tag_name, message)
|
52
52
|
end
|
53
53
|
|
54
54
|
|
@@ -95,7 +95,6 @@ namespace :deploy do
|
|
95
95
|
puts "Found #{tags.length} tags."
|
96
96
|
tags.each_with_index do |tag_name, i|
|
97
97
|
puts
|
98
|
-
ver = tag_name[/v(\d+)/]
|
99
98
|
last_tag = if i == 0
|
100
99
|
`git rev-list --max-parents=0 HEAD`.strip
|
101
100
|
else
|
@@ -119,9 +118,9 @@ namespace :deploy do
|
|
119
118
|
# update or create GitHub release
|
120
119
|
release = releases.find { |rel| rel["tag_name"] == tag_name }
|
121
120
|
if release
|
122
|
-
GithubReleaseParty.update(release["id"],
|
121
|
+
GithubReleaseParty.update(release["id"], tag_name, message)
|
123
122
|
else
|
124
|
-
GithubReleaseParty.create(tag_name,
|
123
|
+
GithubReleaseParty.create(tag_name, message)
|
125
124
|
end
|
126
125
|
end
|
127
126
|
|
data/lib/github-release-party.rb
CHANGED
@@ -20,8 +20,8 @@ class GithubReleaseParty
|
|
20
20
|
return releases
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.update(
|
24
|
-
r = GitHub.patch("/repos/#{repo}/releases/#{
|
23
|
+
def self.update(release_id, name, message)
|
24
|
+
r = GitHub.patch("/repos/#{repo}/releases/#{release_id}", {
|
25
25
|
name: name,
|
26
26
|
body: message,
|
27
27
|
}.to_json)
|
@@ -33,10 +33,10 @@ class GithubReleaseParty
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.create(tag_name,
|
36
|
+
def self.create(tag_name, message)
|
37
37
|
body = {
|
38
38
|
tag_name: tag_name,
|
39
|
-
name:
|
39
|
+
name: tag_name,
|
40
40
|
body: message,
|
41
41
|
}
|
42
42
|
|
data.tar.gz.sig
CHANGED
Binary file
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Sundin
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
E04BZKo2WzOTzSDymo97Yu4YFgyc98umMyeaCvPk4YmdNzqSanAXpY2bnsyu0CF5
|
32
32
|
Td0=
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2022-11-26 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
@@ -47,8 +47,8 @@ dependencies:
|
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '12'
|
50
|
-
description: I use this gem to automatically create GitHub releases when I deploy
|
51
|
-
|
50
|
+
description: I use this gem to automatically create GitHub releases when I deploy.
|
51
|
+
See the GitHub page for usage.
|
52
52
|
email:
|
53
53
|
- rubygems@stefansundin.com
|
54
54
|
executables: []
|
@@ -56,6 +56,7 @@ extensions: []
|
|
56
56
|
extra_rdoc_files: []
|
57
57
|
files:
|
58
58
|
- lib/github-release-party.rb
|
59
|
+
- lib/github-release-party/tasks/fly.rb
|
59
60
|
- lib/github-release-party/tasks/heroku.rb
|
60
61
|
- lib/github-release-party/version.rb
|
61
62
|
homepage: https://github.com/stefansundin/github-release-party
|
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
78
|
- !ruby/object:Gem::Version
|
78
79
|
version: 1.3.6
|
79
80
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
81
|
+
rubygems_version: 3.3.11
|
81
82
|
signing_key:
|
82
83
|
specification_version: 4
|
83
84
|
summary: Easily create GitHub releases.
|
metadata.gz.sig
CHANGED
Binary file
|