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).
This commit is contained in:
@@ -14,6 +14,8 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
name: Semantic Release
|
name: Semantic Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -41,13 +43,3 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: npx semantic-release
|
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"
|
|
||||||
+2
-1
@@ -5,7 +5,8 @@
|
|||||||
"@semantic-release/release-notes-generator",
|
"@semantic-release/release-notes-generator",
|
||||||
"@semantic-release/changelog",
|
"@semantic-release/changelog",
|
||||||
["@semantic-release/exec", {
|
["@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", {
|
["@semantic-release/git", {
|
||||||
"assets": ["Cargo.toml", "Cargo.lock", "CHANGELOG.md"],
|
"assets": ["Cargo.toml", "Cargo.lock", "CHANGELOG.md"],
|
||||||
|
|||||||
Reference in New Issue
Block a user