From b8f1b257e0bf17a2794815bb13a09ce295e11055 Mon Sep 17 00:00:00 2001 From: Kyle Decot Date: Sat, 19 Oct 2019 10:38:12 -0400 Subject: [PATCH] Adds Script to Publish to Github Package Registry/Rubygems.org --- .gitignore | 2 +- bin/publish | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 bin/publish diff --git a/.gitignore b/.gitignore index c51c30b..c2ecb12 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,6 @@ /spec/reports/ /tmp/ -# rspec failure tracking .rspec_status .DS_Store +*.gem diff --git a/bin/publish b/bin/publish new file mode 100755 index 0000000..875eb12 --- /dev/null +++ b/bin/publish @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require 'optparse' +require 'app_store_connect/version' + +OPTIONS = { + hosts: [], + version: AppStoreConnect::VERSION +}.freeze + +HOSTS = { + rubygems: 'https://rubygems.org', + github: 'https://rubygems.pkg.github.com/kyledecot' +}.freeze + +OptionParser.new do |parser| + HOSTS.keys.each do |key| + parser.on("--#{key}") do + OPTIONS[:hosts] << key + end + end + + parser.on('--version VERSION') do |version| + OPTIONS[:version] = version + end + + parser.on('--help', '-h') do + puts parser + exit(0) + end +end.parse! + +OPTIONS[:hosts].each do |key| + ENV['RUBYGEMS_HOST'] = HOSTS.fetch(key) + + system "gem push -k #{key} app_store_connect-#{OPTIONS[:version]}.gem" +end