Skip to content

Handling error exception gracefully for OAuth API failures #68

Handling error exception gracefully for OAuth API failures

Handling error exception gracefully for OAuth API failures #68

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
- name: Install dependencies
run: bundle install
- name: Build
run: gem build *.gemspec
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: gems
path: '*.gem'
test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
ruby-version: ['2.6', '2.7', '3.0', '3.1']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Ruby latest
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
- name: Install dependencies
run: bundle install
- name: Run tests and collect coverage
run: bundle exec rake
- name: Upload coverage to Codecov
if: ${{ matrix.ruby-version == 3.1 }}
uses: codecov/codecov-action@v3
with:
files: ${{ github.workspace }}/coverage/coverage.xml
publish:
name: Publish
if: startsWith(github.ref, 'refs/tags/v')
needs: [build, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo apt-get install -y oathtool
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
with:
name: gems
path: gems
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
- name: Publish gems to Rubygems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_API_KEY}\n" > $HOME/.gem/credentials
gem push gems/*.gem
env:
GEM_API_KEY: ${{secrets.GEM_API_KEY}}