Skip to content

Commit 0f8bd00

Browse files
Merge pull request #5860 from zeroclaw-labs/fix/release-tag-immutability
fix(ci): split tag push from release creation to avoid immutable-release error
2 parents 8f543fe + 311fd2d commit 0f8bd00

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

.github/workflows/release-stable-manual.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -444,23 +444,22 @@ jobs:
444444
EVENT_NAME: ${{ github.event_name }}
445445
COMMIT_SHA: ${{ github.sha }}
446446
run: |
447-
# For manual dispatch, use --target to create tag + release atomically
448-
# via RELEASE_TOKEN (admin PAT) which bypasses tag protection rules.
449-
# For tag push, the tag already exists — just create the release.
447+
# For manual dispatch, push the tag explicitly via git first using
448+
# the RELEASE_TOKEN checkout (admin PAT bypasses tag protection rules),
449+
# then create the release for the existing tag. This avoids the GitHub
450+
# "tag_name was used by an immutable release" API error that --target
451+
# triggers when a same-named tag was previously used by a deleted
452+
# immutable release.
453+
# For tag push, the tag already exists — skip straight to release creation.
450454
if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
451-
gh release create "$TAG" release-assets/* \
452-
--repo "$GITHUB_REPOSITORY" \
453-
--title "$TAG" \
454-
--notes-file release-notes.md \
455-
--target "$COMMIT_SHA" \
456-
--latest
457-
else
458-
gh release create "$TAG" release-assets/* \
459-
--repo "$GITHUB_REPOSITORY" \
460-
--title "$TAG" \
461-
--notes-file release-notes.md \
462-
--latest
455+
git tag "$TAG" "$COMMIT_SHA"
456+
git push origin "$TAG"
463457
fi
458+
gh release create "$TAG" release-assets/* \
459+
--repo "$GITHUB_REPOSITORY" \
460+
--title "$TAG" \
461+
--notes-file release-notes.md \
462+
--latest
464463
465464
- name: Remove CHANGELOG-next.md after stable release
466465
shell: bash

0 commit comments

Comments
 (0)