From 18295378f2a6e62f3a75ea1779902bebc78275d7 Mon Sep 17 00:00:00 2001 From: TheMeinerLP Date: Tue, 4 Aug 2026 16:18:57 +0200 Subject: [PATCH] feat: expose release-please outputs to calling workflows The workflow ran the action but forwarded none of its outputs, so a caller doing what the README already documents: publish: needs: release-please if: needs.release-please.outputs.release_created == 'true' got an empty string, the condition evaluated to false, and the follow-up job never ran. The release was tagged and nothing was published - a failure that only shows up at the next release, and looks like a publishing problem rather than a wiring one. Forwards release_created, releases_created, tag_name, version, sha, paths_released and prs. Names verified against the action's source rather than assumed: action.yml declares no outputs at all, they are set dynamically via core.setOutput, and tagName is deliberately published as tag_name for backwards compatibility. The per-package values on a multi-package manifest are prefixed with the package path, so their names are not knowable ahead of time and cannot be declared here. That is documented on release_created, together with the pointer to releases_created and paths_released. The README's release-please example is updated to show the gating pattern it was already assuming, and pinned to a release tag rather than the unmaintained @v2 major alias. --- .github/workflows/release-please.yml | 35 ++++++++++++++++++++++++++++ README.md | 33 ++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index bea9c57..90f1490 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -23,6 +23,28 @@ on: required: false type: string default: "ubuntu-latest" + outputs: + release_created: + description: "'true' when the root package was released. Gate a publish or docker job on this. Only set for the root package - on a multi-package manifest other paths are exposed by the action as '--release_created', which a reusable workflow cannot forward." + value: ${{ jobs.release-please.outputs.release_created }} + releases_created: + description: "'true' when at least one release was created. Use this rather than release_created on a multi-package manifest." + value: ${{ jobs.release-please.outputs.releases_created }} + tag_name: + description: "Tag of the root package's release, e.g. v1.2.3. Empty when it was not released." + value: ${{ jobs.release-please.outputs.tag_name }} + version: + description: "Version of the root package's release, e.g. 1.2.3 - the tag without its prefix. Empty when it was not released." + value: ${{ jobs.release-please.outputs.version }} + sha: + description: "Commit the root package's release was cut from." + value: ${{ jobs.release-please.outputs.sha }} + paths_released: + description: "JSON array of the released package paths. The one to iterate over on a multi-package manifest." + value: ${{ jobs.release-please.outputs.paths_released }} + prs: + description: "JSON array of the release pull requests opened or updated by this run." + value: ${{ jobs.release-please.outputs.prs }} jobs: release-please: @@ -31,8 +53,21 @@ jobs: permissions: contents: write pull-requests: write + # Forwarded from the action so callers can gate follow-up jobs. Without them a caller's + # `if: needs.release-please.outputs.release_created == 'true'` silently evaluates to false and + # the follow-up never runs - the release is tagged, but nothing is published. The README has + # documented that exact pattern all along. + outputs: + release_created: ${{ steps.release.outputs.release_created }} + releases_created: ${{ steps.release.outputs.releases_created }} + tag_name: ${{ steps.release.outputs.tag_name }} + version: ${{ steps.release.outputs.version }} + sha: ${{ steps.release.outputs.sha }} + paths_released: ${{ steps.release.outputs.paths_released }} + prs: ${{ steps.release.outputs.prs }} steps: - name: Run release-please + id: release uses: googleapis/release-please-action@v5 with: config-file: ${{ inputs.config-file }} diff --git a/README.md b/README.md index 616edf6..44c05ac 100644 --- a/README.md +++ b/README.md @@ -176,10 +176,39 @@ permissions: pull-requests: write jobs: - release: - uses: OneLiteFeatherNET/workflows/.github/workflows/release-please.yml@v2 + release-please: + uses: OneLiteFeatherNET/workflows/.github/workflows/release-please.yml@v2.5.0 ``` +The workflow forwards the action's outputs, so a follow-up job can be gated on whether a +release was actually cut: + +```yaml +jobs: + release-please: + uses: OneLiteFeatherNET/workflows/.github/workflows/release-please.yml@v2.5.0 + + publish: + needs: release-please + if: needs.release-please.outputs.release_created == 'true' + uses: OneLiteFeatherNET/workflows/.github/workflows/gradle-publish.yml@v2.5.0 + secrets: inherit +``` + +| Output | Description | +|---|---| +| `release_created` | `'true'` when the root package was released. | +| `releases_created` | `'true'` when at least one release was created - use this on a multi-package manifest. | +| `tag_name` | Tag of the root package's release, e.g. `v1.2.3`. Empty when it was not released. | +| `version` | Version of the root package's release, e.g. `1.2.3`. Empty when it was not released. | +| `sha` | Commit the root package's release was cut from. | +| `paths_released` | JSON array of released package paths. | +| `prs` | JSON array of the release pull requests opened or updated. | + +On a multi-package manifest the action exposes per-package values as `--release_created` +and friends. Those names are not fixed, so a reusable workflow cannot declare them - gate on +`releases_created` and read `paths_released` instead. + ### Close invalid PRs ```yaml