CNB 自动发布插件,自动管理仓库的 tag 和 release 版本号。
v1.0.1示例:
v1.0.1 → v1.0.2v1.0.99 → v1.1.0v1.99.99 → v2.0.0在 .cnb.yml 流水线配置中使用:
stages:
- name: auto-release
image: docker.cnb.cool/r_r/auto-release:latest
settings:
tagFormat: "v@{version}"
dryRun: false
stringv@{version}@{version} 会由生成的版本号替换。如版本号为 1.2.3,则 v@{version} 生成 v1.2.3。示例:
stages:
- name: auto-release
image: docker.cnb.cool/r_r/auto-release:latest
settings:
tagFormat: "v-@{version}"
booleanfalse示例:
stages:
- name: auto-release
image: docker.cnb.cool/r_r/auto-release:latest
settings:
dryRun: true
stringstringhttps://api.cnb.cool。string无论是否 dry-run,均会输出以下流水线变量:
##[set-output auto-tag=v1.0.1]
##[set-output auto-release=v1.0.1]
可在后续步骤中通过 @{auto-tag} 和 @{auto-release} 引用。
main:
push:
- stages:
- name: auto-release
image: docker.cnb.cool/r_r/auto-release:latest
settings:
tagFormat: "v@{version}"
dryRun: false
exports:
auto-tag: AUTO_TAG
auto-release: AUTO_RELEASE
- name: echo env
script:
- echo "AUTO_TAG $AUTO_TAG"
- echo "AUTO_RELEASE $AUTO_RELEASE"
main:
push:
- stages:
- name: auto-release-other-repo
image: docker.cnb.cool/r_r/auto-release:latest
settings:
slug: "other-owner/other-repo"
endpoint: "https://api.cnb.cool"
token: "${OTHER_REPO_TOKEN}"
遇到 API 错误或参数缺失时,插件会退出并返回非零状态码,导致流水线失败。
MIT License