forked from ticketmaster-api/ticketmaster-api.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
83 lines (60 loc) · 2.33 KB
/
Rakefile
File metadata and controls
83 lines (60 loc) · 2.33 KB
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
72
73
74
75
76
77
78
79
80
require "rubygems"
require 'rake'
require 'yaml'
require 'time'
namespace 'travis' do
SOURCE_BRANCH = 'dev'
DEPLOY_BRANCH = 'master'
REPORT_BRANCH = 'report'
VERSION_URL = 'https://pages.github.com/versions.json'
desc 'Publish site to GitHub Pages from Travis'
task :deploy do
if ENV['TRAVIS_TEST_RESULT'].to_i != 0
puts "Skipping deployment due to test failure"
next
end
if ENV['TRAVIS_PULL_REQUEST'] != "false" or ENV['TRAVIS_BRANCH'] != SOURCE_BRANCH
puts "Skipping deployment from #{ENV['TRAVIS_BRANCH']}"
if ENV['TRAVIS_PULL_REQUEST'] != "false"
puts "This brach is pull request."
end
next
end
repo = %x(git config remote.origin.url).gsub(/^git:/, 'https:')
system "git remote set-url --push origin #{repo}"
system 'git config credential.helper "store --file=.git/credentials"'
File.open('.git/credentials', 'w') do |f|
f.write("https://#{ENV['GH_TOKEN']}:x-oauth-basic@github.com")
end
puts "Deploying from #{SOURCE_BRANCH} to #{DEPLOY_BRANCH}"
deployed = system "git push origin #{SOURCE_BRANCH}:#{DEPLOY_BRANCH}"
puts "Deployed: #{deployed}"
File.delete '.git/credentials'
if not deployed
exit 1
end
end
desc 'save report to GitHub from Travis'
task :report do
repo = %x(git config remote.origin.url).gsub(/^git:/, 'https:')
system "git remote set-url --push origin #{repo}"
system 'git config credential.helper "store --file=.git/credentials"'
File.open('.git/credentials', 'w') do |f|
f.write("https://#{ENV['GH_TOKEN']}:x-oauth-basic@github.com")
end
puts "Report from #{SOURCE_BRANCH} to #{REPORT_BRANCH} add files to 'tests/galen/reports/all'"
system "git config --global user.email 'de.gratnik@gmail.com'"
system "git config --global user.name 'degratnik' "
system "git config --global push.default current"
system "git add tests/galen"
system "git commit --allow-empty --amend -m 'Auto-Report from Travis #{Time.now.utc.to_s}'"
system "git checkout -b #{REPORT_BRANCH}"
reported = system "git push -u -f origin #{REPORT_BRANCH}"
puts "Reported: #{reported}"
puts "Reported-time(at UTC=+0000): #{Time.now.utc.to_s}"
File.delete '.git/credentials'
if not reported
exit 1
end
end
end