Merge pull request #2 from oneclick-llc/fix/retain_errors #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ruby Gem | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
test: | |
name: Rspec testing | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3.1 | |
bundler-cache: true | |
env: | |
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: ${{ secrets.BUNDLE_RUBYGEMS__PKG__GITHUB__COM }} | |
- name: Cache Ruby Gems | |
uses: actions/cache@v2 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Bundle Install | |
run: | | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: Run RSpec | |
env: | |
RAILS_ENV: test | |
run: | | |
bundle exec rspec | |
- name: Run linters | |
run: | | |
bundle exec rubocop --parallel | |
continue-on-error: true | |
build: | |
name: Build and Push | |
needs: [test] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Ruby 3.3 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3.1 | |
bundler-cache: true | |
- name: Dry run for getting a version | |
id: get_tag_version | |
uses: mathieudutour/github-tag-action@v6.1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
dry_run: true | |
release_branches: main,develop | |
tag_prefix: "" | |
- name: Publish to GPR | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | |
GEM_VERSION=${{ steps.get_tag_version.outputs.new_tag }} gem build *.gemspec | |
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem | |
env: | |
GEM_HOST_API_KEY: "Bearer ${{ secrets.GITHUB_TOKEN }}" | |
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: ${{ secrets.BUNDLE_RUBYGEMS__PKG__GITHUB__COM }} | |
OWNER: ${{ github.repository_owner }} |