项目版本发布
creating-a-release
使用 release-it 为本项目创建、打标签并发布新版本。当用户要求创建、切分、打标签或发布版本,或提升项目版本时使用。
- License 许可
- MIT
- 最近更新
- 2026-11-06
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- creating-a-release
- description
- Cut, tag, and publish a new release of this project using release-it. Use when asked to create, cut, tag, or publish a release, or bump the project version.
03 SKILL.md 正文
Creating a release
This project (per the limenet/laravel-baseline
standards) releases with release-it and the
@release-it/bumper plugin. Versioning is semantic and the canonical version lives in
composer.json.
When to use this skill
Use this when the task is to create, cut, tag, or publish a new release — or otherwise bump the project's version.
How to release
A release is often started and then left to run unattended — waiting for CI can take a while, and the user may have walked away by the time it ends. So every question is asked in step 1, before any waiting starts. From step 2 on, do not ask the user anything: whatever would need them then is a stop, reported once the task ends.
Work through the steps in order. Do not start the release until step 2 says CI is green.
1. Settle everything up front
Gather what follows, then put every open question to the user in one AskUserQuestion call
(it takes up to four questions). Only once all of them are answered move on to step 2.
-
Clean working tree. release-it refuses to run on uncommitted changes. If
git status --porcelainprints anything, ask how to resolve it — do not commit or stash on the user's behalf. -
Has CI seen
HEAD?git fetch, then comparegit rev-parse HEADwithgit rev-parse @{u}. IfHEADhas commits the remote does not, no pipeline covers them yet — ask whether to push them. -
The version increment. How the next version is chosen depends on whether the project uses Conventional Commits. It does when
.release-it.jsonconfigures the@release-it/conventional-changelogplugin — check the file, not the commit log.-
Conventional Commits — release-it derives the increment from the commits since the last tag. Pass no increment and ask nothing, unless the user explicitly asked for a specific one.
-
No Conventional Commits — release-it has nothing to derive the increment from, so it has to come from the user. If the request already names
major,minor, orpatch, use that. Otherwise ask withAskUserQuestion— never a plain-text question, which an unattended run would leave sitting in the transcript. Read what is being released first:git log "$(git describe --tags --abbrev=0)"..HEAD --onelineOffer
major,minorandpatchas the options, put the increment semver suggests for those commits first and mark it(Recommended), and summarise the commits in the question. Do not pick one on the user's behalf.
-
-
Credentials. Make sure nothing will fail for want of a login after the wait:
- the CI CLI for the remote (
git remote get-url origin) is authenticated —gh auth statusorglab auth status; - the token release-it needs for the remote release is set —
GITHUB_TOKENwhen.release-it.jsonenablesgithub.release,GITLAB_TOKENwhen it enablesgitlab.release. Check that the variable is non-empty; never print it.
If either is missing, ask the user to fix it now.
- the CI CLI for the remote (
If the user chose to push, push now — the pipeline that push starts is the one step 2 waits for.
2. Wait for CI to be green
A release tags whatever HEAD is, so that commit has to have passed CI first.
-
Look up the pipeline for the branch with the CLI matching the remote:
GitLab (
glab):branch=$(git branch --show-current) glab ci get --branch "$branch" --output json --jq '{sha, status}'If the status is still running (
created,waiting_for_resource,preparing,pending,running,scheduled), block until it ends, then read the status again:glab ci status --branch "$branch" --wait glab ci get --branch "$branch" --output json --jq '{sha, status}'GitHub (
gh) — one push can start several workflow runs, so check all of them forHEAD:gh run list --branch "$(git branch --show-current)" --commit "$(git rev-parse HEAD)" \ --json databaseId,name,status,conclusionFor every run whose
statusis notcompleted, wait for it:gh run watch <databaseId> --exit-status -
Release only when the pipeline for
HEADis green — GitLabsuccess, or every GitHub run concludedsuccess(skipped/neutralare fine). If it failed or was cancelled, stop: report the failing job to the user and do not release.If nothing ran for
HEADitself — workflow path filters can skip a commit, and GitLab's pipelineshamay then belong to an earlier one — the latest pipeline on the branch is the gate instead and has to be green. If the project has no CI at all, say so and proceed.
3. Run the release
Run release-it non-interactively — its prompts need a terminal an agent cannot answer. --ci
skips them, and the increment argument stands in for the version prompt:
# Conventional Commits, no explicit increment
npm run release -- --ci
# Otherwise (or to override), with the increment from step 1
npm run release -- minor --ci
release-it handles the version bump, git tag, commit, and (if configured) the remote release.
The @release-it/bumper plugin writes the chosen version into the version field of
composer.json, keeping it the single source of truth. In a WordPress theme an after:bump hook
then rewrites the Version: header of style.css to match, so the theme WordPress sees carries the
same version and the change lands in the release commit.
4. Watch the tag pipeline
Pushing the tag usually starts a pipeline of its own — the one that builds, publishes or deploys the release — so the task is not done when release-it exits. Watch it the same way as in step 2, for the tag's commit:
tag=$(git describe --tags --abbrev=0)
GitLab — the tag is a ref like a branch:
glab ci status --branch "$tag" --wait
glab ci get --branch "$tag" --output json --jq '{sha, status}'
GitHub — list every run for the tagged commit and gh run watch <databaseId> --exit-status
each one not yet completed:
gh run list --commit "$(git rev-list -n 1 "$tag")" --json databaseId,name,event,headBranch,status,conclusion
A pipeline can take a few seconds to appear after the push; if none shows up, check again a couple of times over about a minute before concluding the project runs nothing on tags — then say so. Report the outcome either way. If the tag pipeline fails, report the failing job and stop: the tag is already public, so do not delete, move or re-create it — fixing the failure is a separate change.
Conventions
- Semantic versioning. The next version is patch / minor / major per semver, chosen as in step 1.
composer.jsonversionis authoritative. Do not hand-edit it for a release — letnpm run release/@release-it/bumperset it.- Never release on red. A failed or cancelled pipeline for
HEADends the task; fixing it is a separate change. - A release ends with its tag pipeline. Report how the pipeline the tag started finished, not just that release-it exited.
Configuration reference
The relevant config the baseline enforces:
package.json→scripts.release="release-it".release-it.json→plugins['@release-it/bumper'].out={ "file": "composer.json", "path": "version" }- WordPress themes:
.release-it.json→hooks['after:bump']includes a command rewriting theVersion:header ofstyle.css
04 同仓库更多 Skills
composer 与 npm 依赖更新
updating-dependencies
更新项目的 composer 和 npm 依赖,审查变更日志(changelog)对其在本项目中的影响,并报告因语义化版本(semver)而被阻止的主版本升级。当被要求更新或升级依赖、执行每月依赖更新,或由 `updatesDependencies` 周期性基线检查触发时使用。
Trivy 漏洞忽略项管理
ignoring-trivy-findings
在 .trivyignore.yaml 中添加、续期或删减条目——或因修复版本仍处于 npm 安装冷却期内而短期忽略,或因升级受项目约束阻碍而长期忽略。当 Trivy `security` CI 任务因某个漏洞而失败、被要求忽略或抑制某条 Trivy 发现,或审查现有 Trivy 忽略项时使用。
Composer 与 npm 依赖更新
updating-dependencies
更新项目的 composer 和 npm 依赖,审查变更日志(changelog)对本项目的可能影响,并报告因语义化版本(semver)约束而被阻挡的主版本升级。当用户要求更新或升级依赖、执行每月依赖更新,或由 `updatesDependencies` 周期性基线检查触发时使用。
Trivy 漏洞忽略项管理
ignoring-trivy-findings
在 .trivyignore.yaml 中添加、续期或清理条目——要么因修复版本仍处于 npm 安装冷却期内而短期忽略,要么因升级受项目约束阻挡而长期忽略。当 Trivy `security` CI 任务因某个漏洞失败、被要求忽略或抑制某项 Trivy 发现,或审查现有 Trivy 忽略项时使用。
Laravel 项目版本发布
creating-a-release
使用 release-it 为本 Laravel 项目创建、打标签并发布新版本。当用户要求创建、切分、打标签或发布版本,或提升项目版本时使用。
Laravel 惯用法审查
auditing-laravel-idioms
审查项目的缓存、会话和请求数据使用情况,确认遵循现代 Laravel 惯用法(类型化缓存 getter、BackedEnum 键、whenFilledEnum)。当被要求审查或检查现代 Laravel 惯用法采用情况,或由 `followsModernLaravelIdioms` 周期性基线检查触发时使用。