autoship
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAutomated Releases with autoship
借助autoship实现自动化发布
Core Workflow
核心工作流
Every release follows this pattern:
- Configure: (one-time setup)
autoship add <name> - Release: (interactive) or
autoship <name>(automated)autoship <name> -t patch -y
The tool handles the complete release cycle:
- Clone repository
- Analyze changes and suggest release type (patch/minor/major)
- Generate AI-powered changeset description
- Create and merge changeset PR
- Wait for and merge Version Packages PR
- Trigger npm publish
每次发布都遵循以下流程:
- 配置:(仅需一次设置)
autoship add <name> - 发布:(交互式)或
autoship <name>(自动化)autoship <name> -t patch -y
该工具可处理完整的发布周期:
- 克隆仓库
- 分析变更并建议发布类型(补丁/小版本/大版本)
- 生成AI驱动的changeset说明
- 创建并合并changeset拉取请求(PR)
- 等待并合并版本包PR
- 触发npm发布
Requirements
前置要求
Before using autoship, ensure:
bash
undefined在使用autoship之前,请确保:
bash
undefinedGitHub CLI must be authenticated
GitHub CLI 必须已完成认证
gh auth login
gh auth login
API key for AI features
AI功能所需的API密钥
export AI_GATEWAY_API_KEY="your-key"
undefinedexport AI_GATEWAY_API_KEY="your-key"
undefinedEssential Commands
核心命令
bash
undefinedbash
undefinedOne-time setup: add a repository
一次性设置:添加仓库
autoship add myproject
autoship add myproject
Prompts for: owner, repo name, base branch
会提示输入:所有者、仓库名称、基础分支
List configured repositories
列出已配置的仓库
autoship list
autoship list
Interactive release (prompts for type and message)
交互式发布(提示选择类型和输入信息)
autoship myproject
autoship myproject
Automated release (no prompts)
自动化发布(无提示)
autoship myproject -t patch -y
autoship myproject -t minor -y
autoship myproject -t major -y
autoship myproject -t patch -y
autoship myproject -t minor -y
autoship myproject -t major -y
Release with custom message (skips AI generation)
自定义信息发布(跳过AI生成)
autoship myproject -t patch -m "Fixed login bug" -y
undefinedautoship myproject -t patch -m "修复登录bug" -y
undefinedCommand Options
命令选项
bash
autoship [repo] # Interactive repo selection if omitted
-t, --type <type> # Release type: patch, minor, major
-m, --message <message> # Custom changeset description
-y, --yes # Skip all confirmations
-h, --help # Show helpbash
autoship [repo] # 若省略则进入交互式仓库选择
-t, --type <type> # 发布类型:patch, minor, major
-m, --message <message> # 自定义changeset说明
-y, --yes # 跳过所有确认步骤
-h, --help # 显示帮助信息Common Patterns
常见使用场景
Fully Automated Patch Release
完全自动化补丁发布
bash
autoship myproject -t patch -ybash
autoship myproject -t patch -yAI-Assisted Interactive Release
AI辅助交互式发布
bash
autoship myprojectbash
autoship myproject1. AI analyzes commits since last release
1. AI分析上次发布后的提交记录
2. AI suggests release type (patch/minor/major)
2. AI建议发布类型(补丁/小版本/大版本)
3. You confirm or change the type
3. 你可确认或修改发布类型
4. AI generates changeset description
4. AI生成changeset说明
5. You review and approve
5. 你审核并确认
6. Tool handles PR creation and merging
6. 工具处理PR创建与合并
undefinedundefinedCustom Message Release
自定义信息发布
bash
autoship myproject -t minor -m "Added new authentication providers" -ybash
autoship myproject -t minor -m "新增身份验证提供商" -yCI/CD Integration
CI/CD集成
bash
undefinedbash
undefinedIn GitHub Actions or CI pipeline
在GitHub Actions或CI流水线中
export AI_GATEWAY_API_KEY="${{ secrets.AI_GATEWAY_API_KEY }}"
npx autoship myproject -t patch -y
undefinedexport AI_GATEWAY_API_KEY="${{ secrets.AI_GATEWAY_API_KEY }}"
npx autoship myproject -t patch -y
undefinedWhat autoship Does (10 Steps)
autoship的工作流程(10步)
- Clone - Clones the repository from the base branch
- Analyze - Finds latest version tag, analyzes commits and diff
- Suggest - AI suggests release type based on changes
- Generate - AI generates changeset description
- Branch - Creates release branch with changeset file
- PR - Creates pull request for the changeset
- Wait - Waits for CI checks to pass
- Merge - Merges the changeset PR
- Version PR - Waits for changesets action to create Version Packages PR
- Publish - Merges Version Packages PR to trigger npm publish
- 克隆 - 从基础分支克隆仓库
- 分析 - 查找最新版本标签,分析提交记录与差异
- 建议 - AI根据变更内容建议发布类型
- 生成 - AI生成changeset说明
- 分支 - 创建包含changeset文件的发布分支
- PR - 创建changeset的拉取请求
- 等待 - 等待CI检查通过
- 合并 - 合并changeset PR
- 版本PR - 等待changesets动作创建版本包PR
- 发布 - 合并版本包PR以触发npm发布
Output Format
输出格式
autoship provides clear step-by-step output:
[1/10] Cloning repository from main...
> Repository cloned
> Package: my-package @ 1.2.3
[2/10] Creating release branch...
> Branch created: release/patch-1706123456789
[3/10] Generating changeset...
> Changeset created: fluffy-pants-dance.md
...
Release Complete!
The patch release has been published.autoship提供清晰的分步输出:
[1/10] Cloning repository from main...
> Repository cloned
> Package: my-package @ 1.2.3
[2/10] Creating release branch...
> Branch created: release/patch-1706123456789
[3/10] Generating changeset...
> Changeset created: fluffy-pants-dance.md
...
Release Complete!
The patch release has been published.Configuration
配置
Config is stored at :
~/.autoship/config.jsonjson
{
"repos": {
"myproject": {
"owner": "vercel-labs",
"repo": "myproject",
"baseBranch": "main",
"cloneUrl": "https://github.com/vercel-labs/myproject.git"
}
}
}配置文件存储在:
~/.autoship/config.jsonjson
{
"repos": {
"myproject": {
"owner": "vercel-labs",
"repo": "myproject",
"baseBranch": "main",
"cloneUrl": "https://github.com/vercel-labs/myproject.git"
}
}
}Deep-Dive Documentation
深度文档
| Reference | When to Use |
|---|---|
| references/commands.md | Full command reference with all options |
| references/configuration.md | Config file format and repository setup |
| references/ci-integration.md | GitHub Actions and CI/CD setup |
| 参考文档 | 使用场景 |
|---|---|
| references/commands.md | 包含所有选项的完整命令参考 |
| references/configuration.md | 配置文件格式与仓库设置 |
| references/ci-integration.md | GitHub Actions与CI/CD设置 |
Ready-to-Use Templates
即用型模板
| Template | Description |
|---|---|
| templates/automated-release.sh | Fully automated release script |
| templates/setup-repo.sh | Non-interactive repository setup |
bash
./templates/automated-release.sh myproject patch
./templates/setup-repo.sh myproject vercel-labs myproject main| 模板 | 描述 |
|---|---|
| templates/automated-release.sh | 完全自动化的发布脚本 |
| templates/setup-repo.sh | 非交互式仓库设置脚本 |
bash
./templates/automated-release.sh myproject patch
./templates/setup-repo.sh myproject vercel-labs myproject mainTroubleshooting
故障排查
"No repositories configured"
"未配置任何仓库"
Run to configure a repository first.
autoship add <name>先运行来配置仓库。
autoship add <name>"Repository not found"
"仓库未找到"
Check for available repos. The name is case-sensitive.
autoship list查看中的可用仓库,名称区分大小写。
autoship listCI checks failing
CI检查失败
The tool will show which checks failed. Fix the issues in the target repository, then retry.
工具会显示哪些检查失败。修复目标仓库中的问题后重试。
AI generation failed
AI生成失败
If AI fails, autoship falls back to manual input. Ensure is set.
AI_GATEWAY_API_KEY若AI生成失败,autoship会回退到手动输入。请确保已设置。
AI_GATEWAY_API_KEY