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
17 changes: 15 additions & 2 deletions .github/workflows/publish-merged-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Publish merged release

on:
workflow_call:
inputs:
workflows-ref:
description: The github-workflows SHA this caller pins in `uses:`. Callers must set it.
required: false
type: string
pull_request:
branches: [main]
types: [closed]
Expand All @@ -17,6 +23,13 @@ jobs:
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 0
- name: Check out this workflow revision
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
repository: dilettacal/github-workflows
# github.workflow_sha is the caller's commit inside workflow_call.
ref: ${{ inputs.workflows-ref || github.workflow_sha }}
path: .shared-workflows
- name: Publish tag and release
env:
GH_TOKEN: ${{ github.token }}
Expand All @@ -25,8 +38,8 @@ jobs:
set -euo pipefail
version="${PR_TITLE#chore(release): }"
version="${version%% *}"
python3 scripts/release.py validate-prepared --version "$version"
python3 .shared-workflows/scripts/release.py validate-prepared --version "$version"
git tag "v$version"
git push origin "v$version"
python3 scripts/release.py release-notes --version "$version" > release-notes.md
python3 .shared-workflows/scripts/release.py release-notes --version "$version" > release-notes.md
gh release create "v$version" --title "v$version" --notes-file release-notes.md
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to these reusable GitHub Actions workflows are recorded here

## [Unreleased]

### Added

- Reusable `publish-merged-release.yml` so consumer repositories publish the tag and GitHub Release when the release PR merges, without a second dispatch.

## [0.1.1] - 2026-10-31

### Fixed
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ Shared GitHub Actions policy and release workflows, maintained once and pinned b
| Workflow | Purpose |
| --- | --- |
| `pull-request-policy.yml` | Checks Conventional Commit-style PR titles and requires a changed `CHANGELOG.md` for releasable work. |
| `publish-release.yml` | Prepares a versioned release PR, then publishes the tag and GitHub Release after that PR merges. |
| `publish-release.yml` | Prepares a versioned release PR. |
| `publish-merged-release.yml` | Publishes the tag and GitHub Release when a `chore(release): X.Y.Z` PR merges. |

## Use

Copy a caller from [`examples/`](examples/), pin `<pinned-sha>`, and keep the
caller responsible for events, permissions, checks, and branch protection.

Release callers pass the same SHA as `workflows-ref`: inside `workflow_call`,
Release and publish callers pass the same SHA as `workflows-ref`: inside `workflow_call`,
`github.workflow_sha` is the caller's commit, not this repository's.

Release callers dispatch `X.Y.Z`: first run opens a release PR; after merging
it, run the same version again to publish the tag and GitHub Release.
Release callers dispatch `X.Y.Z` once to open a release PR. With the
`publish-merged-release.yml` caller, merging that PR publishes the tag and
GitHub Release. Without it, dispatch the same version again after merging.

## Development

Expand Down
15 changes: 15 additions & 0 deletions examples/publish-merged-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish merged release

on:
pull_request:
branches: [main]
types: [closed]

permissions:
contents: write

jobs:
publish:
uses: dilettacal/github-workflows/.github/workflows/publish-merged-release.yml@<pinned-sha>
with:
workflows-ref: <pinned-sha>
Loading