From 8bbac4d24ed5a1e862a2531067aa8a62c5072849 Mon Sep 17 00:00:00 2001 From: Soumya Ranjan Mahunt Date: Thu, 10 Mar 2022 21:29:07 +0530 Subject: [PATCH] ci: add publish to cocoapods repo task --- .github/workflows/main.yml | 9 +++++ Gemfile | 2 + Gemfile.lock | 47 ++++++++++++++++++++++ Rakefile | 15 +++++++ lib/cocoapods-embed-flutter/gem_version.rb | 1 - 5 files changed, 73 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4036d47..503c174 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -99,6 +99,11 @@ jobs: # with: # ruby-version: ${{ env.RUBY_VER }} + # - name: Install dependencies + # run: | + # bundle config deployment true + # bundle install + # - name: Build gem # if: steps.conventional_changelog.outputs.skipped == 'false' # run: gem build *.gemspec @@ -134,3 +139,7 @@ jobs: # tag: ${{ steps.conventional_changelog.outputs.tag }} # body: ${{ steps.conventional_changelog.outputs.changelog }} # artifacts: '*.gem' + + # - name: Publish to cocoapods plugins + # if: steps.conventional_changelog.outputs.skipped == 'false' + # run: bundle exec rake publish diff --git a/Gemfile b/Gemfile index 631d211..6af8f0b 100644 --- a/Gemfile +++ b/Gemfile @@ -5,9 +5,11 @@ gemspec group :development do gem 'cocoapods' + gem 'cocoapods-plugins' gem 'mocha' gem 'bacon' gem 'mocha-on-bacon' gem 'prettybacon' + gem 'github_api' end diff --git a/Gemfile.lock b/Gemfile.lock index d2cdff2..748e1f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -64,32 +64,77 @@ GEM cocoapods-try (1.2.0) colored2 (3.1.2) concurrent-ruby (1.1.9) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) escape (0.0.4) ethon (0.15.0) ffi (>= 1.15.0) + faraday (1.10.0) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.3) + multipart-post (>= 1.2, < 3) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) ffi (1.15.5) fileutils (1.6.0) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) + github_api (0.19.0) + addressable (~> 2.4) + descendants_tracker (~> 0.0.4) + faraday (>= 0.8, < 2) + hashie (~> 3.5, >= 3.5.2) + oauth2 (~> 1.0) + hashie (3.6.0) httpclient (2.8.3) i18n (1.10.0) concurrent-ruby (~> 1.0) json (2.6.1) + jwt (2.3.0) minitest (5.15.0) mocha (1.13.0) mocha-on-bacon (0.2.3) mocha (>= 0.13.0) molinillo (0.8.0) + multi_json (1.15.0) + multi_xml (0.6.0) + multipart-post (2.1.1) nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) + oauth2 (1.4.9) + faraday (>= 0.17.3, < 3.0) + jwt (>= 1.0, < 3.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 3) prettybacon (0.0.2) bacon (~> 1.2) public_suffix (4.0.6) + rack (2.2.3) rake (13.0.6) rexml (3.2.5) ruby-macho (2.5.1) + ruby2_keywords (0.0.5) + thread_safe (0.3.6) typhoeus (1.4.0) ethon (>= 0.9.0) tzinfo (2.0.4) @@ -114,6 +159,8 @@ DEPENDENCIES bundler cocoapods cocoapods-embed-flutter! + cocoapods-plugins + github_api mocha mocha-on-bacon prettybacon diff --git a/Rakefile b/Rakefile index 175d0da..47c4207 100644 --- a/Rakefile +++ b/Rakefile @@ -20,5 +20,20 @@ task :demo do end end +desc 'Publish to cocoapods plugins if not present' +task :publish do + require 'rubygems' + gem = Gem::Specification::load(Dir['*.gemspec'].first) + + require 'cocoapods' + require 'pod/command/plugins_helper' + known_plugins = Pod::Command::PluginsHelper.known_plugins + return if known_plugins.one? { |plugin| plugin['gem'] == gem.name } + + require 'github_api' + return if Github.search.issues(q: "#{gem.name} user:CocoaPods repo:CocoaPods/cocoapods-plugins in:title").items.count > 0 + system('pod plugins publish', exception: true) +end + task :default => :specs diff --git a/lib/cocoapods-embed-flutter/gem_version.rb b/lib/cocoapods-embed-flutter/gem_version.rb index 89fb474..b24ba21 100644 --- a/lib/cocoapods-embed-flutter/gem_version.rb +++ b/lib/cocoapods-embed-flutter/gem_version.rb @@ -1,4 +1,3 @@ module CocoapodsEmbedFlutter VERSION = '0.5.0'.freeze - NAME = 'cocoapods-embed-flutter' end