Skip to content
Draft
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
46 changes: 11 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,20 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: Optional release version overriding the checked-in version.
type: string
required: false

permissions:
contents: write
id-token: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Extract changelog
id: changelog
shell: bash
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME}"
version="${tag#v}"
notes="$(awk -v version="$version" '
$0 ~ "^### " version " " {found=1; next}
found && $0 ~ "^### " {exit}
found {print}
' CHANGELOG.md)"
if [[ -z "${notes// }" ]]; then
echo "No changelog entry found for ${version}" >&2
exit 1
fi
{
echo "notes<<EOF"
echo "$notes"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.notes }}
uses: dblock/ruby-gem-release/.github/workflows/release.yml@v0.6.0
with:
ruby-version: '3.4'
version: ${{ inputs.version }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#### Fixes

* [#1017](https://github.com/ruby-grape/grape-swagger/pull/1017): Release through the manual Release workflow with `ruby-gem-release` and RubyGems Trusted Publishing, replacing the tag-triggered GitHub Release workflow and local `rake release` - [@numbata](https://github.com/numbata).
* [#905](https://github.com/ruby-grape/grape-swagger/pull/905): Allow Float, BigDecimal and beginless ranges in `values` to set `minimum` and `maximum`, and skip infinite bounds that cannot be serialized to JSON - [@artyomb](https://github.com/artyomb).
* [#1016](https://github.com/ruby-grape/grape-swagger/pull/1016): Hide the nested parameters of a Hash parameter marked `documentation: { hidden: true }`, and pass the resolved `token_owner` to parameter-level `hidden:` procs like route-level ones (raising `TokenOwnerNotFound` if the configured method is missing) - [@numbata](https://github.com/numbata).
* [#1013](https://github.com/ruby-grape/grape-swagger/pull/1013): Fix array `default` values being placed inside `items` instead of on the array parameter or property, and emit an empty array `default` - [@numbata](https://github.com/numbata).
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ group :development, :test do
gem 'rdoc'
gem 'rspec', '~> 3.9'
gem 'rubocop', '~> 1.50', require: false
# ruby-gem-release requires Ruby 3.3+; older CI Rubies skip it.
gem 'ruby-gem-release', require: false if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3.0')

unless ENV['MODEL_PARSER'] == 'grape-swagger-entity'
gem 'grape-swagger-entity', git: 'https://github.com/ruby-grape/grape-swagger-entity'
Expand Down
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ require 'rake'

Bundler::GemHelper.install_tasks

# Publish only through the Release workflow, never a local push to rubygems.org.
Rake::Task['release'].clear
desc 'Publish through the Release workflow'
task :release do
abort 'Dispatch the Release workflow instead: gh workflow run release.yml'
end

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3.0')
require 'ruby-gem-release/workflow/ruby_gem'
require 'ruby-gem-release/changelog'

RubyGemRelease::Workflow::RubyGem.new(
version: RubyGemRelease::Version::RubyConstant.new(path: 'lib/grape-swagger/version.rb', constant: 'VERSION'),
changelog: RubyGemRelease::Changelog::Intridea.new(path: 'CHANGELOG.md', placeholder: '* Your contribution here.')
).install_tasks
end

require 'rspec/core'
require 'rspec/core/rake_task'

Expand Down
Loading