diff --git a/.github/workflows/gem.yml b/.github/workflows/gem.yml new file mode 100644 index 00000000..28b25553 --- /dev/null +++ b/.github/workflows/gem.yml @@ -0,0 +1,24 @@ +name: Release Gem + +on: + release: + types: [published] + +jobs: + release_gem: + name: Release to gem hosts + runs-on: ubuntu-latest + steps: + - name: Checkout inspec_tools + uses: actions/checkout@v2 + - name: Publish to Rubygems + uses: cadwallion/publish-rubygems-action@v1.0.0 + with: + RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + env: + RELEASE_COMMAND: rake publish + - name: Publish to GitHub + uses: jstastny/publish-gem-to-github@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + owner: mitre diff --git a/.travis.yml b/.travis.yml index 1262a542..f6cd912d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ branches: language: ruby cache: bundler -bundler_args: --without integration --without tools --without development +bundler_args: --without integration --without tools before_install: - sudo apt-get update @@ -21,3 +21,4 @@ matrix: - rvm: 2.3 - rvm: 2.4 - rvm: 2.5 + - rvm: 2.6 diff --git a/Rakefile b/Rakefile index 12b60d13..0d21c8d1 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ require "bundler/gem_tasks" require "rake/testtask" +require File.expand_path('../lib/inspec_tools/version', __FILE__) Rake::TestTask.new(:test) do |t| t.libs << "test" @@ -21,4 +22,9 @@ namespace :test do end end +desc 'Build and publish the gem' +task publish: :build do + system("gem push pkg/inspec_tools-#{InspecTools::VERSION}.gem") +end + task :default => :test diff --git a/inspec_tools.gemspec b/inspec_tools.gemspec index 0f3b3bdb..572bb184 100644 --- a/inspec_tools.gemspec +++ b/inspec_tools.gemspec @@ -24,12 +24,13 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' end - spec.files = Dir.glob('{lib,test,exe}/**/*') + %w{CHANGELOG.md Guardfile LICENSE.md Rakefile README.md} + spec.files = Dir.glob('{lib,exe}/**/*') + %w{CHANGELOG.md Guardfile LICENSE.md Rakefile README.md} spec.bindir = 'exe' spec.executables << 'inspec_tools' - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] + spec.required_ruby_version = '~> 2.3' + spec.add_dependency 'colorize', '~> 0' spec.add_dependency 'inspec', ">= 3.0", "< 5.0" spec.add_dependency 'nokogiri', '~> 1.8' @@ -42,5 +43,5 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength spec.add_development_dependency 'bundler', '~> 2.0' spec.add_development_dependency 'minitest', '~> 5.0' spec.add_development_dependency 'pry', '~> 0' - spec.add_dependency 'rake', '>= 11.1' + spec.add_development_dependency 'rake', '~> 13.0' end