From 6c8c98e86cf27b6a998124e3de3b226a78c82f66 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Fri, 28 Aug 2026 17:10:02 +0700 Subject: [PATCH] fix(release): dispatch publish via exec successCmd not step output The prior pattern relying on steps.semantic-release.outputs did not fire. Move the publish dispatch into @semantic-release/exec successCmd, which runs only after a release is actually published and has nextRelease.version available. Also add GH_TOKEN env for gh CLI (GITHUB_TOKEN alone is not read by gh). --- .github/workflows/release.yml | 14 +++----------- .releaserc.json | 3 ++- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad6b427..cca6052 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,8 @@ jobs: release: name: Semantic Release runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 with: @@ -40,14 +42,4 @@ jobs: id: semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: npx semantic-release - - - name: Trigger crate publish - if: ${{ steps.semantic-release.outputs.new_release_published == 'true' }} - env: - RELEASE_VERSION: ${{ steps.semantic-release.outputs.next_release_version }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - TAG="v${RELEASE_VERSION}" - echo "Tagging and dispatching publish for $TAG" - gh workflow run publish.yml --ref main -f tag="$TAG" \ No newline at end of file + run: npx semantic-release \ No newline at end of file diff --git a/.releaserc.json b/.releaserc.json index a6d44a7..006f1a9 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -5,7 +5,8 @@ "@semantic-release/release-notes-generator", "@semantic-release/changelog", ["@semantic-release/exec", { - "prepareCmd": "sed -i 's/^version = \\\"[^\\\"]*\\\"/version = \\\"${nextRelease.version}\\\"/' Cargo.toml && cargo check" + "prepareCmd": "sed -i 's/^version = \\\"[^\\\"]*\\\"/version = \\\"${nextRelease.version}\\\"/' Cargo.toml && cargo check", + "successCmd": "echo \"::notice::release ${nextRelease.version} published; dispatching crate publish\" && gh workflow run publish.yml --ref main -f tag=v${nextRelease.version}" }], ["@semantic-release/git", { "assets": ["Cargo.toml", "Cargo.lock", "CHANGELOG.md"],