Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/rubygems-rake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release

on:
workflow_call:
inputs:
environment:
description: "GitHub environment for the workflow"
type: string
default: "rubygems"

permissions:
# for uploading artifacts to GitHub release
contents: write

# for trusted publishing and attest-build-provenance
id-token: write

# for attest-build-provenance
attestations: write

jobs:
release:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}

steps:
- name: 📥 Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: 🏗️ Set up Ruby
uses: ruby/setup-ruby@2a18b06812b0e15bb916e1df298d3e740422c47e # v1.203.0
with:
bundler-cache: true

- name: 🔄 Sync version file
run: |
version="${GH_VERSION#v}"
if ! ruby -e "require 'rubygems'; Gem::Version.new('$version')"; then
echo "Error: Invalid version string '$version'"
exit 1
fi
sed -i "s/VERSION = '.*'/VERSION = '${version}'/" lib/version.rb

git update-index --skip-worktree lib/version.rb
env:
GH_VERSION: ${{ github.event.release.tag_name }}

- name: 🚀 Publish to rubygems
uses: rubygems/release-gem@9e85cb11501bebc2ae661c1500176316d3987059 # v1.1.0

- name: 🗑️ Clean signable artifacts
run: rm pkg/*.sigstore.json

- name: 🔐 Generate Build Provenance
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
with:
subject-path: "pkg/*"

- name: 📥 Upload to GitHub
run: |
for file in pkg/*; do
gh release upload "${GH_VERSION}" "$file"
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_VERSION: ${{ github.event.release.tag_name }}
Loading