Skip to content

Commit

Permalink
Add Trusted Publishing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dentarg committed Jun 21, 2024
1 parent 1a09707 commit 9e4410f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]

# build gem
- run: bundle exec rake gem:release

# push gem to rubygems.org
- run: gem push --verbose pkg/addressable-${VERSION}.gem
11 changes: 11 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9e4410f

Please sign in to comment.