-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b786fd8
commit 4ee2f27
Showing
4 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
fogg | ||
coverage.out | ||
coverage.out | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
builds: | ||
- binary: fogg | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- darwin | ||
- linux | ||
- windows | ||
goarch: | ||
- amd64 | ||
release: | ||
github: | ||
owner: chanzuckerberg | ||
name: fogg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.0 | ||
0.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'rubygems' | ||
require 'git' | ||
require 'logger' | ||
require 'semantic' | ||
|
||
|
||
RELEASE_TYPES = %w[major minor patch] | ||
|
||
# read release type argument (major, minor, patch) | ||
release_type = ARGV.first | ||
if !RELEASE_TYPES.include?(release_type) | ||
print("Invalid release type '#{release_type}'. Valid options are #{RELEASE_TYPES}\n") | ||
exit(1) | ||
end | ||
|
||
g = Git.open('.') | ||
g.fetch('.', {tags: true}) | ||
|
||
# TODO check that we are on master? or maybe not? | ||
|
||
tag_index = g.tags.inject(Hash.new) do |ind, t| | ||
ind[t.objectish] = t.name | ||
ind | ||
end | ||
|
||
tag, sha = nil, nil | ||
|
||
g.log(1000).each do |c| | ||
if (tag = tag_index[c.sha]) | ||
sha = c.sha | ||
break | ||
end | ||
end | ||
|
||
puts "Found tag #{tag}" | ||
puts "sha for that tag: #{sha}" | ||
|
||
v = open('VERSION').read.strip | ||
|
||
puts "VERSION file says #{v}" | ||
|
||
if tag.sub('v', '') != v | ||
puts "tag does not match version file" | ||
exit(1) | ||
end | ||
|
||
v = Semantic::Version.new(v) | ||
|
||
new_version = v.increment!(release_type.to_sym) | ||
|
||
puts "new version is #{new_version}" | ||
puts "is that ok? (y/n)" | ||
c = STDIN.gets.chomp | ||
if c != 'y' | ||
puts("canceled") | ||
exit(1) | ||
end | ||
|
||
f = open('VERSION', 'w') | ||
f.write(new_version.to_s) | ||
f.close() | ||
|
||
g.add('VERSION') | ||
g.commit("release version #{new_version.to_s}") | ||
g.add_tag("v#{new_version.to_s}") | ||
|
||
`goreleaser release --skip-publish` |