wip #47
This file contains 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: CI | |
on: push | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby_version: | |
- "2.7" | |
- "3.0" | |
- "3.1" | |
steps: | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y -q libsqlite3-dev | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby_version }} | |
bundler-cache: true | |
- name: Install dependencies | |
run: bundle install && bundle exec appraisal install | |
- name: Run Tests | |
run: bundle exec appraisal rspec | |
release-please: | |
name: Release Please | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
release_created: ${{ steps.release-please.outputs.release_created }} | |
tag_name: ${{ steps.release-please.outputs.tag_name }} # e.g. v1.0.0 | |
version: ${{ steps.release-please.outputs.version }} # e.g. 1.0.0 | |
all: ${{ toJSON(steps.release-please.outputs) }} | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release-please | |
with: | |
command: manifest | |
release: | |
runs-on: ubuntu-latest | |
needs: [test, release-please] | |
if: needs.release-please.outputs.release_created | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.1 | |
- name: Build Gem | |
run: gem build *.gemspec | |
- name: Setup credentials | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- ":github: Bearer ${GITHUB_API_KEY}\n" \ | |
>> $HOME/.gem/credentials | |
env: | |
GITHUB_API_KEY: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to GitHub Packages | |
run: | | |
gem push \ | |
--key github \ | |
--host 'https://rubygems.pkg.github.com/${{ github.repository_owner }}' \ | |
*.gem |