Skip to content

ci: harden protected-branch release workflow - #11

Merged
ovaso merged 2 commits into
mainfrom
codex/fix-github-actions
Aug 7, 2026
Merged

ci: harden protected-branch release workflow#11
ovaso merged 2 commits into
mainfrom
codex/fix-github-actions

Conversation

@ovaso

@ovaso ovaso commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary / 变更说明

  • Ignore workspace-local .vscode/ files.
  • Move CI and release builds to supported macOS 15 runner labels.
  • Cancel superseded CI runs and serialize Release runs for the same tag.
  • Validate the v-prefixed remote tag, Cargo package version, and absence of an existing GitHub Release before starting platform builds.
  • Record Linux/macOS dynamic dependencies and document the protected-main PR and post-merge tagging workflow in English and Simplified Chinese.
  • No CLI, manifest, automation protocol, Git safety boundary, or scheduler behavior changes.

Validation / 验证

  • cargo fmt -- --check
  • cargo test --locked
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo build --locked --release
  • Default-disabled check, test, Clippy, and release build
  • cargo deny --offline check advisories bans licenses sources
  • YAML parsing, shell/completion syntax, Markdown relative links, and git diff --check
  • Both language versions of relevant documentation and changelogs are updated / 相关中英文文档与两份 CHANGELOG 已更新

Risk and rollback / 风险与回滚

Risk is limited to GitHub Actions scheduling and release gating. Release runs now require an existing remote tag and stop before platform builds when the tag, version, or existing Release state is invalid. No repository contents, manifests, locking, Git history, or platform scheduler behavior is changed.

Rollback by reverting commit 13fc9de; the separate .gitignore commit can remain independently.

@ovaso ovaso left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13fc9ded2c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +40 to +42
git ls-remote --exit-code --tags
"https://github.com/${GITHUB_REPOSITORY}.git"
"refs/tags/${RELEASE_TAG}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require the release tag to point to protected main

When a maintainer creates a matching v* tag on an unmerged topic-branch commit whose package version matches, this validation only proves that the tag exists remotely; the subsequent checkout, build, and publish all accept it. The workflow can therefore release code that bypassed the newly documented pull-request and required-CI process. Resolve the tag commit and verify that it is the intended commit on origin/main before starting the platform builds.

Useful? React with 👍 / 👎.

contents: read

concurrency:
group: release-${{ inputs.tag || github.ref }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize the release concurrency key

For the same tag, a tag-push run uses a key such as release-refs/tags/v0.4.4, while a manual-dispatch run uses release-v0.4.4. If a manual retry is started while the push-triggered release is still running, GitHub places them in different concurrency groups, so both can pass the initial nonexistence check and race at release creation instead of being serialized as documented. Build the key from the normalized tag name for both event types.

Useful? React with 👍 / 👎.

Comment on lines +48 to +50
if gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "release ${RELEASE_TAG} already exists" >&2
exit 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow retries to recover an incomplete draft release

If gh release create fails while uploading an asset or publishing, it can leave a draft release for the tag, after which the documented manual retry always exits here instead of recovering it. This follows from gh release create --help, which states that separate API calls create a draft, upload the assets, and then publish it. Distinguish a published release from an incomplete draft and resume or explicitly replace the latter so the retry path works after partial publication failures.

Useful? React with 👍 / 👎.

@ovaso

ovaso commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

pass

@ovaso
ovaso merged commit 071cf3d into main Aug 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant