Add initial deployer script for deploying release drafts to github.
This commit is contained in:
parent
f5093adcae
commit
76c01a02e4
|
@ -0,0 +1,64 @@
|
|||
fastlane_version '2.54.1'
|
||||
|
||||
default_platform :mac
|
||||
|
||||
fastlane_require 'json'
|
||||
|
||||
platform :mac do
|
||||
before_all do
|
||||
ensure_git_status_clean
|
||||
ensure_git_branch
|
||||
end
|
||||
|
||||
desc "Releases build."
|
||||
lane :release do |options| # fastlane release tag_name:TAG_NAME – tag_name is required
|
||||
tag_name = options[:tag_name]
|
||||
# we'll get the latest tag on the branch
|
||||
raise 'Tag name is required to create the new tag.' unless tag_name
|
||||
|
||||
# Settings
|
||||
cuckoo_gen_path = '../../Generator/.build/debug/cuckoo_generator'
|
||||
binary_name = 'CuckooGenerator'
|
||||
|
||||
# Personal Access Token
|
||||
access_token = ENV['RELEASE_ACCESS_TOKEN']
|
||||
raise 'Please define enviroment variable "RELEASE_ACCESS_TOKEN" with the personal access token to use.' unless access_token
|
||||
|
||||
# URL variables
|
||||
repo_path = 'MatyasKriz/ivs-calculator'
|
||||
base_url = "github.com/repos/#{repo_path}/releases"
|
||||
api_url = "https://api.#{base_url}"
|
||||
auth_string = "MatyasKriz:#{access_token}"
|
||||
changelog = create_changelog(tag_name).gsub(/`/, '``').gsub(/'/, ''').gsub(/"/, '"').gsub(/\n/, '\\n')
|
||||
|
||||
# https://developer.github.com/v3/repos/releases/#create-a-release
|
||||
creation_body = "'{\"tag_name\":\"#{tag_name}\",\"target_commitish\":\"master\", \"name\":\"New Release – #{tag_name}\", \"body\":\"#{changelog}\", \"draft\":true, \"prerelease\":false}'"
|
||||
creation_response = JSON.parse(`curl -X POST -d #{creation_body} -u #{auth_string} #{api_url} -v`)
|
||||
raise 'Release draft creation failed!' unless creation_response
|
||||
upload_url = (creation_response['upload_url']).sub(/{.*name.*}/, '')
|
||||
|
||||
# https://developer.github.com/v3/repos/releases/#upload-a-release-asset
|
||||
upload_response = JSON.parse(`curl -X POST --data-binary "@#{cuckoo_gen_path}" -u "#{auth_string}" "#{upload_url}?name=#{binary_name}" -H "Content-Type:application/octet-stream"`)
|
||||
raise 'Release draft upload failed!' unless upload_response
|
||||
|
||||
asset_url = upload_response['url']
|
||||
browser_dl_url = upload_response['browser_download_url']
|
||||
# do with these as you please
|
||||
|
||||
puts "All done!\nGo home now...\nI mean go to #{creation_response['url']} and release the thing."
|
||||
end
|
||||
|
||||
def create_changelog new_tag
|
||||
return changelog_from_git_commits(pretty: "- %s", merge_commit_filtering: "exclude_merges")
|
||||
add_git_tag(tag: new_tag, force: true)
|
||||
if changelog
|
||||
changelog.gsub!(/(B|b)ump .*(internal|beta|release).* number.*\n?/, '')
|
||||
else
|
||||
'No new changes, sorry!'
|
||||
end
|
||||
end
|
||||
|
||||
error do |lane, exception|
|
||||
puts "Release failed. This might help: #{exception}"
|
||||
end
|
||||
end
|
|
@ -41,3 +41,4 @@ Generator/*.app
|
|||
.idea/
|
||||
cuckoo_generator
|
||||
Generator/CuckooGenerator.xcodeproj
|
||||
.fastlane
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem 'json'
|
||||
gem 'rest-client'
|
||||
|
||||
gem "fastlane"
|
|
@ -0,0 +1,150 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (2.3.5)
|
||||
addressable (2.5.2)
|
||||
public_suffix (>= 2.0.2, < 4.0)
|
||||
babosa (1.0.2)
|
||||
claide (1.0.2)
|
||||
colored (1.2)
|
||||
colored2 (3.1.2)
|
||||
commander-fastlane (4.4.6)
|
||||
highline (~> 1.7.2)
|
||||
declarative (0.0.9)
|
||||
declarative-option (0.1.0)
|
||||
domain_name (0.5.20170404)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
dotenv (2.2.1)
|
||||
excon (0.58.0)
|
||||
faraday (0.13.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-cookie_jar (0.0.6)
|
||||
faraday (>= 0.7.4)
|
||||
http-cookie (~> 1.0.0)
|
||||
faraday_middleware (0.12.2)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
fastimage (2.1.0)
|
||||
fastlane (2.84.0)
|
||||
CFPropertyList (>= 2.3, < 4.0.0)
|
||||
addressable (>= 2.3, < 3.0.0)
|
||||
babosa (>= 1.0.2, < 2.0.0)
|
||||
bundler (>= 1.12.0, < 2.0.0)
|
||||
colored
|
||||
commander-fastlane (>= 4.4.6, < 5.0.0)
|
||||
dotenv (>= 2.1.1, < 3.0.0)
|
||||
excon (>= 0.45.0, < 1.0.0)
|
||||
faraday (~> 0.9)
|
||||
faraday-cookie_jar (~> 0.0.6)
|
||||
faraday_middleware (~> 0.9)
|
||||
fastimage (>= 2.1.0, < 3.0.0)
|
||||
gh_inspector (>= 1.1.2, < 2.0.0)
|
||||
google-api-client (>= 0.13.1, < 0.14.0)
|
||||
highline (>= 1.7.2, < 2.0.0)
|
||||
json (< 3.0.0)
|
||||
mini_magick (~> 4.5.1)
|
||||
multi_json
|
||||
multi_xml (~> 0.5)
|
||||
multipart-post (~> 2.0.0)
|
||||
plist (>= 3.1.0, < 4.0.0)
|
||||
public_suffix (~> 2.0.0)
|
||||
rubyzip (>= 1.1.0, < 2.0.0)
|
||||
security (= 0.1.3)
|
||||
slack-notifier (>= 2.0.0, < 3.0.0)
|
||||
terminal-notifier (>= 1.6.2, < 2.0.0)
|
||||
terminal-table (>= 1.4.5, < 2.0.0)
|
||||
tty-screen (>= 0.6.3, < 1.0.0)
|
||||
tty-spinner (>= 0.8.0, < 1.0.0)
|
||||
word_wrap (~> 1.0.0)
|
||||
xcodeproj (>= 1.5.2, < 2.0.0)
|
||||
xcpretty (>= 0.2.4, < 1.0.0)
|
||||
xcpretty-travis-formatter (>= 0.0.3)
|
||||
gh_inspector (1.1.3)
|
||||
google-api-client (0.13.1)
|
||||
addressable (~> 2.5, >= 2.5.1)
|
||||
googleauth (~> 0.5)
|
||||
httpclient (>= 2.8.1, < 3.0)
|
||||
mime-types (~> 3.0)
|
||||
representable (~> 3.0)
|
||||
retriable (>= 2.0, < 4.0)
|
||||
googleauth (0.5.3)
|
||||
faraday (~> 0.12)
|
||||
jwt (~> 1.4)
|
||||
logging (~> 2.0)
|
||||
memoist (~> 0.12)
|
||||
multi_json (~> 1.11)
|
||||
os (~> 0.9)
|
||||
signet (~> 0.7)
|
||||
highline (1.7.8)
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
json (2.1.0)
|
||||
jwt (1.5.6)
|
||||
little-plugger (1.1.4)
|
||||
logging (2.2.2)
|
||||
little-plugger (~> 1.1)
|
||||
multi_json (~> 1.10)
|
||||
memoist (0.16.0)
|
||||
mime-types (3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0521)
|
||||
mini_magick (4.5.1)
|
||||
multi_json (1.12.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
nanaimo (0.2.3)
|
||||
netrc (0.11.0)
|
||||
os (0.9.6)
|
||||
plist (3.3.0)
|
||||
public_suffix (2.0.5)
|
||||
representable (3.0.4)
|
||||
declarative (< 0.1.0)
|
||||
declarative-option (< 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
rest-client (2.0.2)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
retriable (3.1.1)
|
||||
rouge (2.0.7)
|
||||
rubyzip (1.2.1)
|
||||
security (0.1.3)
|
||||
signet (0.7.3)
|
||||
addressable (~> 2.3)
|
||||
faraday (~> 0.9)
|
||||
jwt (~> 1.5)
|
||||
multi_json (~> 1.10)
|
||||
slack-notifier (2.3.2)
|
||||
terminal-notifier (1.8.0)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
tty-cursor (0.5.0)
|
||||
tty-screen (0.6.4)
|
||||
tty-spinner (0.8.0)
|
||||
tty-cursor (>= 0.5.0)
|
||||
uber (0.1.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.4)
|
||||
unicode-display_width (1.3.0)
|
||||
word_wrap (1.0.0)
|
||||
xcodeproj (1.5.4)
|
||||
CFPropertyList (~> 2.3.3)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.2.3)
|
||||
xcpretty (0.2.8)
|
||||
rouge (~> 2.0.7)
|
||||
xcpretty-travis-formatter (0.0.4)
|
||||
xcpretty (~> 0.2, >= 0.0.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
fastlane
|
||||
json
|
||||
rest-client
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.1
|
Loading…
Reference in New Issue