From a480771f0eb86b8cc166462a3d275176f07940ad Mon Sep 17 00:00:00 2001 From: Tate Thurston Date: Mon, 17 Jun 2024 16:49:05 -0700 Subject: [PATCH] add art19 revision number and publishing instructions --- .github/dependabot.yml | 7 ------ .github/workflows/ci.yml | 49 ++++++++++++++++++++++------------------ README.md | 17 ++++++++++---- Rakefile | 8 +++++++ gemfiles/Gemfile.rails60 | 6 +++++ gemfiles/Gemfile.rails61 | 6 +++++ gemfiles/Gemfile.rails70 | 6 +++++ gemfiles/Gemfile.rails71 | 6 +++++ jsonapi.rb.gemspec | 17 +++++++------- lib/jsonapi/version.rb | 8 ++++++- 10 files changed, 87 insertions(+), 43 deletions(-) delete mode 100644 .github/dependabot.yml create mode 100644 gemfiles/Gemfile.rails60 create mode 100644 gemfiles/Gemfile.rails61 create mode 100644 gemfiles/Gemfile.rails70 create mode 100644 gemfiles/Gemfile.rails71 diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index c73a811..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9e837c..96491e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,34 +1,39 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - main + - master + pull_request: jobs: - ruby_rails_test_matrix: + test: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - ruby: ['3.0', '3.1', '3.2', '3.3'] - rails: ['6.1', '7.0', '7.1'] - exclude: - - ruby: 3.2 - rails: 6 + ruby: ["3.0", "3.1", "3.2", "3.3"] + rails: ["61", "70", "71"] + env: + # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps + # See https://github.com/ruby/setup-ruby/blob/master/README.md#matrix-of-gemfiles + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.rails${{ matrix.rails }} + + name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true - - name: Runs code QA and tests - env: - RAILS_VERSION: ~> ${{ matrix.rails }} - run: | - rm -rf Gemfile.lock - sudo apt-get update - sudo apt-get install libsqlite3-dev - echo $RAILS_VERSION | grep -q '5' && export SQLITE3_VERSION='~> 1.3.6' - bundle - bundle exec rake + - run: | + sudo apt-get update + sudo apt-get install libsqlite3-dev + bundle exec rake spec + env: + RAILS_ENV: test diff --git a/README.md b/README.md index ef6b2dc..3a73948 100644 --- a/README.md +++ b/README.md @@ -380,11 +380,6 @@ Then, run `rake spec` to run the tests. To install this gem onto your local machine, run `bundle exec rake install`. -To release a new version, update the version number in `version.rb`, and then -run `bundle exec rake release`, which will create a git tag for the version, -push git commits and tags, and push the `.gem` file to -[rubygems.org](https://rubygems.org). - ## Contributing Bug reports and pull requests are welcome on GitHub at @@ -394,6 +389,18 @@ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. +### ART19 Gem Publishing + +Releases are manual, performed locally on a developer's machine. Gems are published to Github Packages. A comprehensive outline of this process can be found here: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry. + +1. Increment the `ART19_REVISION` in [lib/jsonapi/version.rb#L5](https://github.com/art19/jsonapi.rb/blob/master/lib/jsonapi/version.rb#L4) + +2. Publish the gem: + +``` +bundle exec rake publish +``` + ## License The gem is available as open source under the terms of the diff --git a/Rakefile b/Rakefile index 55a130d..a1ec061 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,14 @@ require 'rubocop/rake_task' require 'yaml' require 'yardstick' +desc 'Build the package and publish it to rubygems.pkg.github.com' +task publish: :build do + # Requires local setup of personal access token, see: + # 1. https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry#authenticating-with-a-personal-access-token + system("gem push --key github --host https://rubygems.pkg.github.com/art19 " \ + "pkg/jsonapi.rb-#{JSONAPI::VERSION}.gem") +end + # rubocop:disable Rails/RakeEnvironment desc('Documentation stats and measurements') task('qa:docs') do diff --git a/gemfiles/Gemfile.rails60 b/gemfiles/Gemfile.rails60 new file mode 100644 index 0000000..f0b2177 --- /dev/null +++ b/gemfiles/Gemfile.rails60 @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "railties", "~> 6.0.6" +gem "activerecord", "~> 6.0.6" + +gemspec :path => "../" diff --git a/gemfiles/Gemfile.rails61 b/gemfiles/Gemfile.rails61 new file mode 100644 index 0000000..82b4eec --- /dev/null +++ b/gemfiles/Gemfile.rails61 @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "railties", "~> 6.1" +gem "activerecord", "~> 6.1" + +gemspec :path => "../" diff --git a/gemfiles/Gemfile.rails70 b/gemfiles/Gemfile.rails70 new file mode 100644 index 0000000..dced085 --- /dev/null +++ b/gemfiles/Gemfile.rails70 @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "railties", "~> 7.0" +gem "activerecord", "~> 7.0" + +gemspec :path => "../" diff --git a/gemfiles/Gemfile.rails71 b/gemfiles/Gemfile.rails71 new file mode 100644 index 0000000..afb35eb --- /dev/null +++ b/gemfiles/Gemfile.rails71 @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "railties", "~> 7.1" +gem "activerecord", "~> 7.1" + +gemspec :path => "../" diff --git a/jsonapi.rb.gemspec b/jsonapi.rb.gemspec index eec2dad..dc61eba 100644 --- a/jsonapi.rb.gemspec +++ b/jsonapi.rb.gemspec @@ -4,10 +4,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'jsonapi/version' Gem::Specification.new do |spec| - spec.name = 'jsonapi.rb' - spec.version = JSONAPI::VERSION - spec.authors = ['Stas Suscov'] - spec.email = ['stas@nerd.ro'] + spec.name = 'jsonapi.rb' + spec.version = JSONAPI::VERSION + spec.metadata["allowed_push_host"] = 'https://rubygems.pkg.github.com/art19' + spec.authors = ['Stas Suscov'] + spec.email = ['stas@nerd.ro'] spec.summary = 'So you say you need JSON:API support in your API...' spec.description = ( @@ -29,16 +30,16 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler' spec.add_development_dependency 'ransack' - spec.add_development_dependency 'railties', ENV['RAILS_VERSION'] - spec.add_development_dependency 'activerecord', ENV['RAILS_VERSION'] - spec.add_development_dependency 'sqlite3', ENV['SQLITE3_VERSION'] + spec.add_development_dependency 'railties' + spec.add_development_dependency 'activerecord' + spec.add_development_dependency 'sqlite3', '~> 1.3' spec.add_development_dependency 'ffaker' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'rspec-rails' spec.add_development_dependency 'jsonapi-rspec' spec.add_development_dependency 'yardstick' spec.add_development_dependency 'rubocop-rails_config' - spec.add_development_dependency 'rubocop', ENV['RUBOCOP_VERSION'] + spec.add_development_dependency 'rubocop' spec.add_development_dependency 'simplecov' spec.add_development_dependency 'rubocop-performance' end diff --git a/lib/jsonapi/version.rb b/lib/jsonapi/version.rb index e013a61..6b3524d 100644 --- a/lib/jsonapi/version.rb +++ b/lib/jsonapi/version.rb @@ -1,3 +1,9 @@ module JSONAPI - VERSION = '2.0.1' + ## + # ART19 maintains a fork with patches applied on top of the upstream gem. + # We publish our fork with a revision number appended to the upstream version. + # + # @return [String] the ART19 revision number + ART19_REVISION = '1'.freeze + VERSION = "2.0.1.#{ART19_REVISION}".freeze end