forked from openware/peatio
-
Notifications
You must be signed in to change notification settings - Fork 6
/
release.rake
37 lines (30 loc) · 1.2 KB
/
release.rake
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
require 'bump'
def bot_username
ENV.fetch('BOT_USERNAME', 'kite-bot')
end
def repository_slug
ENV.fetch('REPOSITORY_SLUG', 'rubykube/peatio')
end
namespace 'release' do
desc 'Bump the version of the application'
task :travis do
unless ENV['TRAVIS_BRANCH'] == 'master'
Kernel.abort 'Bumping version aborted: GitHub pull request detected.'
end
if ENV['TRAVIS_PULL_REQUEST'] != 'false'
Kernel.abort 'Bumping version aborted: GitHub pull request detected.'
end
unless ENV['TRAVIS_TAG'].to_s.empty?
Kernel.abort 'Bumping version aborted: the build has been triggered by Git tag.'
end
sh %(git config --global user.name 'OpenWare')
sh %(git config --global user.email 'support@openware.com')
sh %(git remote add authenticated-origin https://#{bot_username}:#{ENV.fetch('GITHUB_API_KEY')}@github.com/#{repository_slug})
next_version = Bump::Bump.send(:next_version, Bump::Bump.current, 'patch')
sh %(V='#{next_version}' bin/gendocs)
sh %(git add -A)
Bump::Bump.run('patch', commit_message: '[skip ci]', tag: false)
sh %(git tag #{Bump::Bump.current})
sh %(git push --tags authenticated-origin HEAD:#{ENV.fetch('TRAVIS_BRANCH')})
end
end