From 78b1650d42ded89277911a9f2dd91706644fdcd7 Mon Sep 17 00:00:00 2001 From: Eito Katagiri Date: Sun, 17 May 2026 15:09:28 +0900 Subject: [PATCH] ci: add release workflow Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/release.yml | 40 +++++++++++++++++++++++++++++++++++ README.md | 13 ++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7227067 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.4' + bundler-cache: true + + - run: bundle exec rspec spec + + - run: bundle exec rubocop -P + + - run: bundle exec rake build + + - name: Publish gem to RubyGems + env: + GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + run: gem push pkg/*.gem + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + files: pkg/*.gem + generate_release_notes: true diff --git a/README.md b/README.md index 216aba1..7cd2df6 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,19 @@ $ bundle exec appraisal rake spec ``` +## Releasing + +Releases are created from git tags. After the version bump PR is merged into `master`, create and push a tag such as `v4.9.0`. + +```sh +$ git checkout master +$ git pull --ff-only origin master +$ git tag v4.9.0 +$ git push origin v4.9.0 +``` + +Pushing the tag triggers `.github/workflows/release.yml`, which runs the base test suite, builds the gem, publishes it to RubyGems, and creates the matching GitHub Release. The workflow expects the repository secret `RUBYGEMS_API_KEY` to be configured. + ## Contributing ## Versioning