Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Add code for gem relase
Browse files Browse the repository at this point in the history
  • Loading branch information
Rony Xavier committed Jan 14, 2021
1 parent 1480de8 commit 6be9207
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Draft Release

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master

jobs:
draft_release:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: toolmantim/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release Management

on:
release:
types: [published]

jobs:
release:
name: Release to gem hosts and docker registry
runs-on: ubuntu-latest
steps:
- name: Setup ruby
uses: actions/setup-ruby@v1
- uses: actions/checkout@v2
with:
fetch-depth: 0
lfs: true
- run: git fetch origin +refs/tags/*:refs/tags/*
- name: Setup credentials and versioning
run: |
gem install git-lite-version-bump keycutter roo
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
printf -- ":github: Bearer ${GPR_API_KEY}\n" >> $HOME/.gem/credentials
env:
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
GPR_API_KEY: ${{secrets.GITHUB_TOKEN}}
- name: Build gem
run: rake build_release
- name: Get gem version
run: echo "::set-env name=VERSION::$(ls *.gem | grep -Po '(\d+.)+\d+')"
- name: Publish to RubyGems
run: |
gem push --KEY rubygems --host https://rubygems.org *.gem
- name: Publish to GPR
run: |
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
env:
OWNER: mitre
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ Rake::TestTask.new(:functional) do |t|
t.libs << 'lib'
t.test_files = FileList['test/functional/*_test.rb']
end

desc 'Build for release'
task :build_release do

system('gem build inspec-reporter-json-hdf.gemspec')
end

0 comments on commit 6be9207

Please sign in to comment.