Skip to content

Commit

Permalink
Merge pull request #22 from bastelfreak/ci
Browse files Browse the repository at this point in the history
Apply Vox Pupuli CI best practices
  • Loading branch information
bastelfreak authored Sep 22, 2023
2 parents 632dcbb + 780599c commit 6bb43d9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Test

on:
- pull_request
pull_request: {}
push:
branches:
- master

env:
BUNDLE_WITHOUT: release
Expand All @@ -11,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Ruby 3.1
- name: Install Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
ruby-version: "3.2"
bundler-cache: true
- name: Run rubocop
run: bundle exec rake rubocop
Expand All @@ -40,7 +43,7 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Verify gem builds
run: gem build *.gemspec
run: gem build --strict --verbose *.gemspec
- name: Run spec tests
run: bundle exec rake

Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
if: github.repository_owner == 'voxpupuli'
steps:
- uses: actions/checkout@v3
- name: Install Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
env:
BUNDLE_WITHOUT: release
- name: Build gem
run: gem build --strict --verbose *.gemspec
- name: Publish gem to rubygems.org
run: gem push *.gem
env:
GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
- name: Setup GitHub packages access
run: |
mkdir -p ~/.gem
echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
chmod 0600 ~/.gem/credentials
- name: Publish gem to GitHub packages
run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem

0 comments on commit 6bb43d9

Please sign in to comment.