Skip to content

Merge pull request #32 from woovibr/fix/update-version #18

Merge pull request #32 from woovibr/fix/update-version

Merge pull request #32 from woovibr/fix/update-version #18

name: Build code, test it and create a release to a new version of this gem
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
ruby: [ '2.6', '2.7', '3.0', '3.1', '3.2', 'ruby-head' ]
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Set up bundle
run: bundle install --with development
- name: Run linter
run: bundle exec rubocop -d --cache true --parallel
- name: Run Unit Tests
run: bundle exec rspec
release-please:
runs-on: ubuntu-latest
needs: [ test ]
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: ruby
package-name: openpix-ruby_sdk
version-file: "lib/openpix/ruby_sdk/version.rb"
# Checkout code if release was created
- uses: actions/checkout@v3
if: ${{ steps.release.outputs.releases_created }}
# Setup ruby if a release was created
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
if: ${{ steps.release.outputs.releases_created }}
# Bundle install
- run: bundle install
if: ${{ steps.release.outputs.releases_created }}
# Publish
- name: publish gem
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
if: ${{ steps.release.outputs.releases_created }}