autoship

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Automated Releases with autoship

借助autoship实现自动化发布

Core Workflow

核心工作流

Every release follows this pattern:
  1. Configure:
    autoship add <name>
    (one-time setup)
  2. Release:
    autoship <name>
    (interactive) or
    autoship <name> -t patch -y
    (automated)
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
每次发布都遵循以下流程:
  1. 配置
    autoship add <name>
    (仅需一次设置)
  2. 发布
    autoship <name>
    (交互式)或
    autoship <name> -t patch -y
    (自动化)
该工具可处理完整的发布周期:
  • 克隆仓库
  • 分析变更并建议发布类型(补丁/小版本/大版本)
  • 生成AI驱动的changeset说明
  • 创建并合并changeset拉取请求(PR)
  • 等待并合并版本包PR
  • 触发npm发布

Requirements

前置要求

Before using autoship, ensure:
bash
undefined
在使用autoship之前,请确保:
bash
undefined

GitHub 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"
undefined
export AI_GATEWAY_API_KEY="your-key"
undefined

Essential Commands

核心命令

bash
undefined
bash
undefined

One-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
undefined
autoship myproject -t patch -m "修复登录bug" -y
undefined

Command 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 help
bash
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 -y
bash
autoship myproject -t patch -y

AI-Assisted Interactive Release

AI辅助交互式发布

bash
autoship myproject
bash
autoship myproject

1. 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创建与合并

undefined
undefined

Custom Message Release

自定义信息发布

bash
autoship myproject -t minor -m "Added new authentication providers" -y
bash
autoship myproject -t minor -m "新增身份验证提供商" -y

CI/CD Integration

CI/CD集成

bash
undefined
bash
undefined

In GitHub Actions or CI pipeline

在GitHub Actions或CI流水线中

export AI_GATEWAY_API_KEY="${{ secrets.AI_GATEWAY_API_KEY }}" npx autoship myproject -t patch -y
undefined
export AI_GATEWAY_API_KEY="${{ secrets.AI_GATEWAY_API_KEY }}" npx autoship myproject -t patch -y
undefined

What autoship Does (10 Steps)

autoship的工作流程(10步)

  1. Clone - Clones the repository from the base branch
  2. Analyze - Finds latest version tag, analyzes commits and diff
  3. Suggest - AI suggests release type based on changes
  4. Generate - AI generates changeset description
  5. Branch - Creates release branch with changeset file
  6. PR - Creates pull request for the changeset
  7. Wait - Waits for CI checks to pass
  8. Merge - Merges the changeset PR
  9. Version PR - Waits for changesets action to create Version Packages PR
  10. Publish - Merges Version Packages PR to trigger npm publish
  1. 克隆 - 从基础分支克隆仓库
  2. 分析 - 查找最新版本标签,分析提交记录与差异
  3. 建议 - AI根据变更内容建议发布类型
  4. 生成 - AI生成changeset说明
  5. 分支 - 创建包含changeset文件的发布分支
  6. PR - 创建changeset的拉取请求
  7. 等待 - 等待CI检查通过
  8. 合并 - 合并changeset PR
  9. 版本PR - 等待changesets动作创建版本包PR
  10. 发布 - 合并版本包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.json
:
json
{
  "repos": {
    "myproject": {
      "owner": "vercel-labs",
      "repo": "myproject",
      "baseBranch": "main",
      "cloneUrl": "https://github.com/vercel-labs/myproject.git"
    }
  }
}
配置文件存储在
~/.autoship/config.json
json
{
  "repos": {
    "myproject": {
      "owner": "vercel-labs",
      "repo": "myproject",
      "baseBranch": "main",
      "cloneUrl": "https://github.com/vercel-labs/myproject.git"
    }
  }
}

Deep-Dive Documentation

深度文档

ReferenceWhen to Use
references/commands.mdFull command reference with all options
references/configuration.mdConfig file format and repository setup
references/ci-integration.mdGitHub Actions and CI/CD setup
参考文档使用场景
references/commands.md包含所有选项的完整命令参考
references/configuration.md配置文件格式与仓库设置
references/ci-integration.mdGitHub Actions与CI/CD设置

Ready-to-Use Templates

即用型模板

TemplateDescription
templates/automated-release.shFully automated release script
templates/setup-repo.shNon-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 main

Troubleshooting

故障排查

"No repositories configured"

"未配置任何仓库"

Run
autoship add <name>
to configure a repository first.
先运行
autoship add <name>
来配置仓库。

"Repository not found"

"仓库未找到"

Check
autoship list
for available repos. The name is case-sensitive.
查看
autoship list
中的可用仓库,名称区分大小写。

CI 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
AI_GATEWAY_API_KEY
is set.
若AI生成失败,autoship会回退到手动输入。请确保已设置
AI_GATEWAY_API_KEY