Skip to content

fix(release): rewrite release.yml to single-job rubygems/release-gem #2

fix(release): rewrite release.yml to single-job rubygems/release-gem

fix(release): rewrite release.yml to single-job rubygems/release-gem #2

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: read
jobs:
release:
runs-on: ubuntu-latest
environment:
name: rubygems
url: https://rubygems.org/gems/postio
permissions:
contents: write # rubygems/release-gem creates a GH release
id-token: write # Trusted Publishers (OIDC)
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- name: Verify tag matches gem version
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG="${GITHUB_REF#refs/tags/v}"
VERSION=$(ruby -r ./lib/postio/version -e "puts Postio::VERSION")
if [ "$TAG" != "$VERSION" ]; then
echo "::error::Tag v$TAG does not match Postio::VERSION $VERSION"
exit 1
fi
- name: Run offline tests
run: bundle exec rspec
- name: Release gem (Trusted Publishers)
uses: rubygems/release-gem@v1