diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..76b9a5a6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - addressable-* + +jobs: + release: + if: github.repository == 'sporkmonger/addressable' + runs-on: ubuntu-latest + permissions: + id-token: write # for trusted publishing + steps: + # tags are named addressable-VERSION, e.g. addressable-2.8.6 + - name: Set VERSION from git tag + run: echo "VERSION=$(echo ${{ github.ref }} | cut -d - -f 2)" >> "$GITHUB_ENV" + + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: ruby + + - uses: rubygems/configure-rubygems-credentials@v1.0.0 + + # build gem + - run: bundle exec rake gem:release + + # push gem to rubygems.org + - run: gem push --verbose pkg/addressable-${VERSION}.gem diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 00000000..d9d96596 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,11 @@ +# Releasing Addressable + +1. Update `CHANGELOG.md` +1. Update `lib/addressable/version.rb` with the new version +1. Run `rake gem:gemspec` to update gemspec +1. Create pull request with all that +1. Merge the pull request when CI is green +1. Ensure you have latest changes locally +1. Run `rake git:tag:create` to create tag in git +1. Push tag to upstream: `git push --tags upstream` +1. Watch GitHub Actions build and push the gem to RubyGems.org