diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index e3174ae..c8e4d05 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -31,10 +31,16 @@ jobs: BODY="${BODY//$'\n'/'%0A'}" BODY="${BODY//$'\r'/'%0D'}" echo "::set-output name=body::$BODY" + # Add pre-release option if tag name has any suffix after vMAJOR.MINOR.PATCH + if [[ ${GITHUB_REF#refs/tags/} =~ ^v[0-9]+\.[0-9]+\.[0-9]+.+ ]]; then + echo ::set-output name=prerelease::true + fi - name: Build gem run: gem build + - name: Calculate checksums + run: sha256sum yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem > SHA256SUM - name: Check version - run: ls yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem + run: ls -l yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem - name: Create Release id: create_release uses: actions/create-release@v1 @@ -45,9 +51,8 @@ jobs: release_name: ${{ steps.tag.outputs.subject }} body: ${{ steps.tag.outputs.body }} draft: false - prerelease: false - - name: Upload Release Asset - id: upload-release-asset + prerelease: ${{ steps.tag.outputs.prerelease }} + - name: Upload built gem as release asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -56,3 +61,22 @@ jobs: asset_path: yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem asset_name: yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem asset_content_type: application/x-tar + - name: Upload checksums as release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: SHA256SUM + asset_name: SHA256SUM + asset_content_type: text/plain + - name: Publish to GitHub packages + env: + GEM_HOST_API_KEY: Bearer ${{ secrets.GITHUB_TOKEN }} + run: | + gem push yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem --host https://rubygems.pkg.github.com/${{ github.repository_owner }} + - name: Publish to RubyGems + env: + GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_API_KEY }}" + run: | + gem push yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e40ae2..62fc1a8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,7 @@ jobs: fail-fast: false matrix: include: + - ruby: 3.0 - ruby: 2.7 - ruby: 2.6 - ruby: 2.5 diff --git a/README.md b/README.md index fe5c464..02b726c 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,38 @@ docker-compose run app bundle exec rspec Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-puma-plugin. +### Releasing + +1. Bump version number in `lib/yabeda/puma/plugin/version.rb` + + In case of pre-releases keep in mind [rubygems/rubygems#3086](https://github.com/rubygems/rubygems/issues/3086) and check version with command like `Gem::Version.new(Yabeda::VERSION).to_s` + +2. Fill `CHANGELOG.md` with missing changes, add header with version and date. + +3. Make a commit: + + ```sh + git add lib/yabeda/puma/plugin/version.rb CHANGELOG.md + version=$(ruby -r ./lib/yabeda/puma/plugin/version.rb -e "puts Gem::Version.new(Yabeda::Puma::Plugin::VERSION)") + git commit --message="${version}: " --edit + ``` + +4. Create annotated tag: + + ```sh + git tag v${version} --annotate --message="${version}: " --edit --sign + ``` + +5. Fill version name into subject line and (optionally) some description (list of changes will be taken from changelog and appended automatically) + +6. Push it: + + ```sh + git push --follow-tags + ``` + +7. GitHub Actions will create a new release, build and push gem into RubyGems! You're done! + ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).