Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/actions.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is machine-generated by `gh actions-lock`.
# Do not edit by hand; run `gh actions-lock` to update.
# Docs: https://gh.io/actions-lockfile
version: 'v0.0.3'
workflows:
'.github/workflows/ci.yml':
- 'actions/checkout@v7.0.1'
- 'ruby/setup-ruby@v1.336.0'
'.github/workflows/publish.yml':
- 'actions/checkout@v7.0.1'
- 'googleapis/release-please-action@v5.0.0'
- 'ruby/setup-ruby@v1.336.0'
dependencies:
'actions/checkout@v7.0.1':
ref: 'v7.0.1'
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
owner_id: 44036562
repo_id: 197814629
'googleapis/release-please-action@v5.0.0':
ref: 'v5.0.0'
commit: 'sha1-45996ed1f6d02564a971a2fa1b5860e934307cf7'
owner_id: 16785467
repo_id: 262236530
'ruby/setup-ruby@v1.336.0':
ref: 'v1.336.0'
commit: 'sha1-de492cf36cbab201753d720ce4f4e336cd688c94'
owner_id: 210414
repo_id: 231208785
33 changes: 19 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,62 @@
name: CI
on: [push]

on:
push:
branches:
- main
pull_request:

jobs:
rubocop:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@v7.0.1

- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@v1.336.0
with:
ruby-version: 3.3
ruby-version: '3.4'
bundler-cache: true

- name: Run rubocop
run: bundle exec rubocop
run: bundle exec rubocop --format github

brakeman:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@v7.0.1

- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@v1.336.0
with:
ruby-version: 3.3
ruby-version: '3.4'
bundler-cache: true

- name: Run brakeman
run: bundle exec brakeman --quiet --format tabs --force-scan
run: bundle exec brakeman --quiet --format github --force-scan

rspec:
strategy:
fail-fast: false
matrix:
ruby:
- '3.2'
- '3.3'
- '3.4'
- '4.0'
gemfile:
- rails_7_1
- rails_7_2
- rails_8_0
- rails_8_1
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@v7.0.1

- name: Set BUNDLE_GEMFILE
run: echo 'BUNDLE_GEMFILE=${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile' >> $GITHUB_ENV

- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@v1.336.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
Expand Down
67 changes: 41 additions & 26 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,73 @@
name: Publish

on:
release:
types: [published]
push:
branches:
- main

permissions:
contents: write
packages: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
sha: ${{ steps.release.outputs.sha }}
steps:
- uses: googleapis/release-please-action@v5.0.0
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
Comment thread
RinseV marked this conversation as resolved.
Resolved

# Separate jobs so a failed upload can be retried with "Re-run failed jobs" without publishing twice
publish-github:
needs: release
if: ${{ needs.release.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v7.0.1
with:
ref: ${{ needs.release.outputs.sha }}

- name: Setup Ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1.336.0
with:
ruby-version: 3.0
ruby-version: '3.4'

- name: Setup GitHub Package Registry credentials
- name: Build and publish gem to GitHub Package Registry
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: Bearer ${{ secrets.GITHUB_TOKEN }}\n" > $HOME/.gem/credentials

- name: Replace version by tag value
run: sed -i "s/'[0-9]\.[0-9]\..*'/'${GITHUB_REF##*/}'/" lib/keypairs/version.rb

- name: Build and Publish gem to GitHub Package Registry
run: |
gem build --verbose *.gemspec
gem push --verbose --key github --host https://rubygems.pkg.github.com/${OWNER} *.gem
env:
OWNER: Drieam

publish-rubygems:
needs: release
if: ${{ needs.release.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v7.0.1
with:
ref: ${{ needs.release.outputs.sha }}

- name: Setup Ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1.336.0
with:
ruby-version: 3.0
ruby-version: '3.4'

- name: Replace version by tag value
run: sed -i "s/'[0-9]\.[0-9]\..*'/'${GITHUB_REF##*/}'/" lib/keypairs/version.rb

- name: Publish to RubyGems
- name: Build and publish gem to RubyGems
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 --verbose *.gemspec
gem push --verbose *.gem
env:
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
log/*.log
pkg/
spec/internal/db/*.sqlite3
spec/internal/db/*.sqlite3-*
spec/internal/log/*.log
spec/internal/storage/

Expand Down
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{".":"2.0.1"}
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require:
plugins:
- rubocop-performance # Performance optimization analysis
- rubocop-rails # Rails-specific analysis

AllCops:
TargetRubyVersion: 3.2
TargetRubyVersion: 3.3
NewCops: enable
Exclude:
- 'gemfiles/*'
Expand Down
12 changes: 4 additions & 8 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# frozen_string_literal: true

appraise 'rails-6-1' do
gem 'rails', '~> 6.1.0'
appraise 'rails-8-0' do
gem 'rails', '>= 8.0', '< 8.1'
end

appraise 'rails-7-0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7-1' do
gem 'rails', '~> 7.1.0'
appraise 'rails-8-1' do
gem 'rails', '>= 8.1', '< 8.2'
end
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ get :jwks, to: Keypairs::PublicKeysController.action(:index)
```

## Releasing new version
Publishing a new version is handled by the publish workflow. This workflow publishes a GitHub release to rubygems and GitHub package registry with the version defined in the release.
Publishing a new version is handled by [release-please](https://github.com/googleapis/release-please). Whenever a PR is
merged, release-please will create/update a versioning PR. Once this versioning PR is approved and merged, a new version
of the gem will automatically be published to RubyGems and the GitHub package registry. The changelog will be updated
automatically.

## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/Drieam/keypairs.
Expand Down
7 changes: 0 additions & 7 deletions gemfiles/rails_7_2.gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion gemfiles/rails_8_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rails", "~> 8.0.0"
gem "rails", ">= 8.0", "< 8.1"

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_7_1.gemfile → gemfiles/rails_8_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rails", "~> 7.1.0"
gem "rails", ">= 8.1", "< 8.2"

gemspec path: "../"
7 changes: 4 additions & 3 deletions keypairs.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ Gem::Specification.new do |spec|
spec.description = spec.summary
spec.license = 'MIT'

spec.required_ruby_version = '>= 3.2'
spec.required_ruby_version = '>= 3.3'

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/Drieam/keypairs'

spec.files = Dir['{app,db,lib}/**/*', 'LICENSE', 'README.md']

spec.add_dependency 'actionpack', '>= 7.1', '< 9' # Depend on actionpack to share public keys
spec.add_dependency 'activerecord', '>= 7.1', '< 9' # Depend on activerecord as ORM
spec.add_dependency 'actionpack', '>= 8.0', '< 9' # Depend on actionpack to share public keys
spec.add_dependency 'activerecord', '>= 8.0', '< 9' # Depend on activerecord as ORM
spec.add_dependency 'json', '< 3.0' # json 3.0 has breaking changes
spec.add_dependency 'jwt', '>= 2.5', '< 4' # Working with JSON Web Tokens
spec.add_dependency 'lockbox', '>= 1.3', '< 3.0' # Encrypt and decrypt attributes

Expand Down
2 changes: 1 addition & 1 deletion lib/keypairs/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Keypairs
VERSION = '1.3.4.develop'
VERSION = '2.0.1'
end
9 changes: 9 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"packages": {
".": {
"release-type": "ruby",
"version-file": "lib/keypairs/version.rb",
"include-v-in-tag": false
}
}
}
Binary file removed spec/internal/db/keypairs_test.sqlite3-shm
Binary file not shown.
Binary file removed spec/internal/db/keypairs_test.sqlite3-wal
Binary file not shown.
6 changes: 3 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

Bundler.require(*Rails.groups)

Rails.application.config.cache_store = :null_store

# Load the parts from rails we need with combustion
Combustion.initialize! :active_record, :action_controller
Combustion.initialize! :active_record, :action_controller do
config.cache_store = :null_store
end

require 'rspec/rails'

Expand Down
Loading