Skip to content

Commit

Permalink
Merge pull request #100 from mitre/rubygems-release-workflow
Browse files Browse the repository at this point in the history
Rubygems release workflow
  • Loading branch information
Bialogs authored Mar 17, 2020
2 parents 157c8c5 + b54b805 commit 77310c9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/gem.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,3 +21,4 @@ matrix:
- rvm: 2.3
- rvm: 2.4
- rvm: 2.5
- rvm: 2.6
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
7 changes: 4 additions & 3 deletions inspec_tools.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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

0 comments on commit 77310c9

Please sign in to comment.