-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.5.0 Add release info, several fixes
- Loading branch information
Showing
33 changed files
with
522 additions
and
196 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
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
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
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
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 @@ | ||
[{"version_major":0,"version_minor":5,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename the application from \"Madek APP\" to \"Madek Exporter\".\n* Include release info.\n\nFixes\n=====\n\n* Fix export of meta-data of the Type MetaDatum::TextType.\n* Disconnect on the connection page will now delete the saved token, too.\n* Fix spelling and unnecessary involved language in many places.\n"}] |
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 @@ | ||
../prod/releases.yml |
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
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 @@ | ||
[{"version_major":0,"version_minor":5,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename the application from \"Madek APP\" to \"Madek Exporter\".\n* Include release info.\n\nFixes\n=====\n\n* Fix export of meta-data of the Type MetaDatum::TextType.\n* Disconnect on the connection page will now delete the saved token, too.\n* Fix spelling and unnecessary involved language in many places.\n"}] |
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,84 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'active_support/all' | ||
require 'addressable/template' | ||
require 'addressable/uri' | ||
require 'faraday' | ||
require 'faraday_middleware' | ||
require 'json' | ||
require 'pry' | ||
require 'yaml' | ||
|
||
user = ENV['GH_USER'].presence || raise('gh username missing') | ||
token = ENV['GH_TOKEN'].presence || raise('gh token missing') | ||
|
||
conn = Faraday.new() do |conn| | ||
conn.token_auth(token) | ||
conn.basic_auth(user, token) | ||
conn.headers['Content-Type'] = 'application/json' | ||
conn.request :json | ||
conn.response :json, :content_type => /\bjson$/ | ||
conn.adapter Faraday.default_adapter | ||
end | ||
|
||
def _version | ||
release= YAML.load_file('releases.yml').first.with_indifferent_access | ||
"#{release[:version_major]}.#{release[:version_minor]}.#{release[:version_patch]}" \ | ||
+ ( (pre = release[:version_pre]) ? "-#{pre}" : "") \ | ||
+ ( (build = release[:version_build]) ? "+#{build}" : "") | ||
end | ||
|
||
def version | ||
@version ||= _version | ||
end | ||
|
||
def commitish | ||
JSON.parse(ENV['CIDER_CI_CURRENT_BRANCH_HEADS']).first.presence.try(:strip) \ | ||
|| `git log -n 1 --pretty='%H'`.strip | ||
end | ||
|
||
def create_data | ||
{ "tag_name": version, | ||
"target_commitish": commitish, | ||
"name": version, | ||
"body": "Version #{version} of the Madek Exporter", | ||
"draft": true } | ||
end | ||
|
||
existing_release = conn.get do |req| | ||
req.url "https://api.github.com/repos/madek/madek-exporter/releases/tags/#{version}" | ||
end | ||
|
||
if existing_release.status == 200 | ||
raise "tag #{version} already exists" | ||
end | ||
|
||
unless existing_release.status == 404 | ||
raise 'expected response for existing_release is 404' | ||
end | ||
|
||
created_release = conn.post do |req| | ||
req.url "https://api.github.com/repos/madek/madek-exporter/releases" | ||
req.body = create_data.to_json | ||
end | ||
|
||
unless created_release.status == 201 | ||
raise "create release #{version} failed" | ||
end | ||
|
||
upload_url_template = Addressable::Template.new(created_release.body["upload_url"]) | ||
|
||
%w(Madek-App_Linux.zip Madek-App_Mac-OS.zip Madek-App_Windows.zip).each do |filename| | ||
url = upload_url_template.expand(name: filename).to_s | ||
file_content = IO.binread(filename) | ||
uploaded = conn.post do |req| | ||
req.url url | ||
conn.headers['Content-Type'] = 'application/json' | ||
req.body = file_content | ||
end | ||
unless uploaded.status == 201 | ||
raise "upload #{filename} failed" | ||
end | ||
end | ||
|
||
exit 0 |
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,48 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'active_support/all' | ||
require 'json' | ||
require 'optparse' | ||
require 'pry' | ||
require 'yaml' | ||
require 'filewatcher' | ||
|
||
|
||
options = {watch: false, help: false} | ||
|
||
def update | ||
begin | ||
releases_json = YAML.load_file("releases.yml").to_json | ||
IO.write("app/prod/releases.json", releases_json) | ||
IO.write("app/dev/releases.json", releases_json) | ||
puts "Updated app/(prod|dev)/releases.json" | ||
rescue Exception => e | ||
puts e | ||
end | ||
end | ||
|
||
parser = OptionParser.new do|opts| | ||
opts.banner = "Usage: update-releases [options]" | ||
opts.on('-w', '--watch', 'Wach and update continously') do | ||
options[:watch] = true | ||
end | ||
|
||
opts.on('-h', '--help', 'Displays Help') do | ||
options[:help] = true | ||
puts opts | ||
exit | ||
end | ||
end | ||
|
||
parser.parse! | ||
|
||
if not options[:help] | ||
update | ||
end | ||
|
||
if options[:watch] | ||
puts "Watching releases.yml ..." | ||
FileWatcher.new(['releases.yml']).watch do |filename| | ||
update | ||
end | ||
end |
Oops, something went wrong.