Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion .github/workflows/danger-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ permissions:

jobs:
comment:
uses: danger/danger-pr-comment/.github/workflows/danger-comment.yml@v0.3.0
uses: danger/danger-pr-comment/.github/workflows/danger-comment.yml@645e89bcc7be89ee7e8362166110b05cbced8e59 # v0.3.0
with:
comment-empty: false
2 changes: 1 addition & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:

jobs:
danger:
uses: danger/danger-pr-comment/.github/workflows/danger-run.yml@v0.3.0
uses: danger/danger-pr-comment/.github/workflows/danger-run.yml@645e89bcc7be89ee7e8362166110b05cbced8e59 # v0.3.0
with:
ruby-version: '4.0'
bundler-cache: true
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0
with:
ruby-version: '4.0'
bundler-cache: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0
with:
ruby-version: '4.0'
bundler-cache: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- { ruby: '4.0', suite: workflow }
- { ruby: '4.0', suite: consumer }
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0
with:
ruby-version: ${{ matrix.entry.ruby }}
bundler-cache: true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ jobs:
RUBYGEMS_OWNER_ID: ${{ inputs.rubygems-owner }}
TZ: ${{ inputs.timezone }}
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: checkout
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0
id: setup_ruby
with:
ruby-version: ${{ inputs.ruby-version }}
Expand Down Expand Up @@ -120,11 +120,11 @@ jobs:
RUBYGEMS_OWNER_ID: ${{ inputs.rubygems-owner }}
TZ: ${{ inputs.timezone }}
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: checkout
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0
id: setup_ruby
with:
ruby-version: ${{ inputs.ruby-version }}
Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:
run: bundle exec rake release:workflow:checkpoint
- name: Preserve Release Artifacts
id: preserve_release_artifacts
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: release-gem-${{ env.RELEASE_VERSION }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
- { ruby: '3.3' }
- { ruby: '4.0' }
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0
with:
ruby-version: ${{ matrix.entry.ruby }}
bundler-cache: true
Expand All @@ -33,7 +33,7 @@ jobs:
RELEASE_AUTH_MODE: rubygems
- name: Send Coverage to Coveralls
if: matrix.entry.ruby == '4.0'
uses: coverallsapp/github-action@v2
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
2 changes: 2 additions & 0 deletions .spellcheck.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Commonmarker
codename
customizations
dblock
Dependabot
ExecutionContext
ExecutionProvider
gemspec
Expand Down Expand Up @@ -48,6 +49,7 @@ rulesets
RSpec
RuboCop
RubyGems
SHA
strftime
subclasses
subprocess
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Keep orchestration permutations and YAML assertions in focused source specs (`bu

Keep semantic releases opt-in. Calculate from reachable released tags, not development versions; persist one immutable decision across processes, preserve it when recording the next version, and never reanalyze during preparation or publication. Preserve manual workflow defaults and publication guards. Semantic consumer fixtures must verify success, publication failure, and empty-release rejection against the installed artifact without real publication.

The root `action.yml` exposes the same Ruby tasks as a composite action. Keep both interfaces consistent without making version-pinned workflows depend on moving action references. Action callers own job permissions, runner, environment, and concurrency. Preserve authentication selection and failure-aware artifact preservation; run installed-artifact consumer CI and `actionlint .github/workflows/*.yml examples/.github/workflows/*.yml` when changing YAML interfaces.
The root `action.yml` exposes the same Ruby tasks as a composite action. Keep both interfaces consistent without making version-pinned workflows depend on moving action references: pin every external action and reusable workflow to a full commit SHA with its version as a trailing comment, never a tag or branch. Action callers own job permissions, runner, environment, and concurrency. Preserve authentication selection and failure-aware artifact preservation; run installed-artifact consumer CI and `actionlint .github/workflows/*.yml examples/.github/workflows/*.yml` when changing YAML interfaces.

Run `bundle exec rake` locally for specs and RuboCop before every push, and `bundle exec rake build` for package construction when applicable. Danger checks the changelog in PR CI, not as a routine local command. Document user-visible changes in `CHANGELOG.md`, listing entries within each release chronologically and keeping `- Your contribution here.` as the last entry in the next-release section; keep Markdown paragraphs on one source line.

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [#83](https://github.com/dblock/ruby-gem-release/pull/83): Name Intridea subsections with `sections:`, dropping sections without notes from a release and starting every Next section with all of them - [@dblock](https://github.com/dblock).
- [#85](https://github.com/dblock/ruby-gem-release/pull/85): Verify RubyGems Trusted Publishing before every release with a `release:workflow:preflight` task, add a `dry-run` workflow input that runs only that check, and name the token claims in rejected exchanges - [@dblock](https://github.com/dblock).
- [#86](https://github.com/dblock/ruby-gem-release/pull/86): Check that the release token can push to the default branch and that no repository rules would reject the release commit or tag before every release - [@dblock](https://github.com/dblock).
- [#88](https://github.com/dblock/ruby-gem-release/pull/88): Pin every action used by the reusable workflow, the composite action, and this repository's workflows to a commit SHA, with Dependabot proposing updates - [@dblock](https://github.com/dblock).
- Your contribution here.

## 0.7.0 (2026/11/20)
Expand Down
2 changes: 1 addition & 1 deletion DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The checkpoint task commits prepared edits, builds reproducibly, tags locally, a

Every release action must be idempotent for the same checkout and inputs, without recovery flags, artifact discovery, restored context, or a completion journal. Tasks reconcile their own outputs; a fresh workflow uses its current checkout and inputs rather than discovering an older unfinished release. Registry publication and Git pushes cannot be atomic together, so both interfaces preserve artifacts before publication for manual inspection. See [rerunning releases](RELEASING.md#verify-and-recover).

Keep both YAML interfaces thin and consistent. The reusable workflow does not depend on a moving composite-action reference: a pinned release must remain independent of later action versions. Composite callers own permissions, runner, environment protection, and concurrency. Commands run with release privileges and must be trusted.
Keep both YAML interfaces thin and consistent. The reusable workflow does not depend on a moving composite-action reference: a pinned release must remain independent of later action versions. Both interfaces, and this repository's own workflows, pin every external action and reusable workflow to a commit SHA with its version as a comment, so a caller that pins a release by SHA also fixes every action that runs with release credentials. Dependabot proposes updates to those pins. Composite callers own permissions, runner, environment protection, and concurrency. Commands run with release privileges and must be trusted.

## Preparation and Artifact Guards

Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ inputs:
runs:
using: composite
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: checkout
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0
id: setup_ruby
with:
ruby-version: ${{ inputs.ruby-version }}
Expand Down Expand Up @@ -141,7 +141,7 @@ runs:
run: bundle exec rake release:workflow:checkpoint
- name: Preserve Release Artifacts
id: preserve_release_artifacts
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: release-gem-${{ env.RELEASE_VERSION }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
Expand Down
2 changes: 2 additions & 0 deletions docs/actions/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Reference for [`.github/workflows/release.yml`](../../.github/workflows/release.

For a step-based interface with caller-owned job settings, see the [Composite Action](action.md). Both interfaces invoke the same Ruby release tasks; the reusable workflow keeps its own runner, environment, permissions contract, and concurrency group.

Every action the workflow uses is pinned to a commit SHA. RubyGems Trusted Publishing accepts any ref of this repository, so pin the `uses:` line in your caller to the commit of a release tag, with the tag in a trailing comment, such as `dblock/ruby-gem-release/.github/workflows/release.yml@<commit> # v0.8.0`. That fixes both this workflow and the actions it runs with release credentials.

## Inputs

Set these under the calling job's `with:` mapping. Only `ruby-version` is required.
Expand Down
16 changes: 13 additions & 3 deletions spec/workflow_interfaces_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
RSpec.describe 'Release interface contracts' do
shared_examples 'a release interface' do
it 'captures after setup, validates before edits, and uses normal failure gating downstream' do
setup = steps.index { |step| step['uses'] == 'ruby/setup-ruby@v1' }
setup = steps.index { |step| step['uses'].to_s.start_with?('ruby/setup-ruby@') }
capture = steps.index { |step| step['id'] == 'capture_release_context' }
validation = steps.index { |step| step['id'] == 'validate_release' }
expect(capture).to be > setup
Expand Down Expand Up @@ -159,6 +159,16 @@ def run_step(id, directory:, command: '')
end
end

it 'pins every external action and reusable workflow to a commit with its version as a comment', :aggregate_failures do
references = Dir['.github/workflows/*.yml', 'action.yml'].flat_map do |path|
File.readlines(path).filter_map { |line| [path, line.strip] if line.match?(/\A\s*-?\s*uses:\s/) }
end
expect(references).not_to be_empty
references.reject { |_path, line| line.match?(%r{uses: \./}) }.each do |path, line|
expect(line).to match(%r{\A-?\s*uses: [\w.-]+/[\w./-]+@[0-9a-f]{40} # v\d+(\.\d+)*\z}), "#{path}: #{line}"
end
end

context 'with Danger reporting workflows' do
let(:producer) { YAML.load_file('.github/workflows/danger.yml') }
let(:commenter) { YAML.load_file('.github/workflows/danger-comment.yml') }
Expand All @@ -167,7 +177,7 @@ def run_step(id, directory:, command: '')
expect(producer.fetch(true).keys).to eq(['pull_request'])
expect(producer.fetch('permissions')).to eq('contents' => 'read')
job = producer.fetch('jobs').fetch('danger')
expect(job.fetch('uses')).to eq('danger/danger-pr-comment/.github/workflows/danger-run.yml@v0.3.0')
expect(job.fetch('uses')).to eq('danger/danger-pr-comment/.github/workflows/danger-run.yml@645e89bcc7be89ee7e8362166110b05cbced8e59')
expect(job.fetch('with')).not_to have_key('danger-args')
expect(job).not_to have_key('secrets')
end
Expand All @@ -176,7 +186,7 @@ def run_step(id, directory:, command: '')
expect(commenter.fetch(true)).to eq('workflow_run' => { 'workflows' => ['Danger'], 'types' => ['completed'] })
expect(commenter.fetch('permissions')).to eq('actions' => 'read', 'issues' => 'write', 'pull-requests' => 'write')
job = commenter.fetch('jobs').fetch('comment')
expect(job).to eq('uses' => 'danger/danger-pr-comment/.github/workflows/danger-comment.yml@v0.3.0', 'with' => { 'comment-empty' => false })
expect(job).to eq('uses' => 'danger/danger-pr-comment/.github/workflows/danger-comment.yml@645e89bcc7be89ee7e8362166110b05cbced8e59', 'with' => { 'comment-empty' => false })
end
end
end
Loading