Consolidates sections 5–8 of the original
docs/prompt.md, aligning them with the current GoReleaser setup, winget checklist, and post-release validation.
.goreleaser.yaml (片段):
project_name: hello
builds:
- id: win
main: .
goos: [windows]
goarch: [amd64, arm64]
env: [CGO_ENABLED=0]
ldflags:
- "-s -w"
- "-X main.version=v{{ .Version }}"
archives:
- id: windows-exe
ids: [win]
format: binary
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"goreleaser init # 首次项目设置时执行
goreleaser release --snapshot # 本地 Dry Run,产物放在 dist/对于正式发布:
git fetch --tags
git tag -a v0.1.1 -m "v0.1.1"
goreleaser release --clean产物包含:
hello-cli_v0.1.1_macos_amd64
hello-cli_v0.1.1_macos_arm64
hello-cli_v0.1.1_linux_amd64
hello-cli_v0.1.1_linux_arm64
hello-cli_v0.1.1_windows_amd64.exe
hello-cli_v0.1.1_windows_arm64.exe
checksums.txt
.github/workflows/release.yml:
name: release
on:
push:
tags: ["v*.*.*"]
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Run unit tests
run: go test ./...
- uses: goreleaser/goreleaser-action@v5
with:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}提醒:
fetch-depth: 0确保 GoReleaser 能读取历史标签生成变更日志;单元测试步骤 可阻止带缺陷的提交进入发布流程。
完整细节请参考
docs/winget-publishing-guide.md。
wingetcreate new `
--url https://github.com/dongzhenye/hello-cli/releases/download/v0.1.1/hello-cli_v0.1.1_windows_amd64.exe `
--publisher "Zhenye Dong" `
--name "Hello CLI" `
--version 0.1.1 `
--interactive false
winget validate .\manifests\d\dongzhenye\hello-cli\0.1.1随后手动到 microsoft/winget-pkgs 提交 PR。
- 打开 WingetCreate GUI → “New manifest from URL”
- 粘贴 Windows 安装包下载地址(AMD64 + ARM64)
- 关键字段:
- Publisher:
Zhenye Dong - Package Identifier:
dongzhenye.hello-cli - Package Name:
Hello CLI - Version:
0.1.1 - Moniker:
hello
- Publisher:
- 保存并提交 PR
winget search hello # 应显示 Moniker=hello
winget install hello-cli
hello # => Hello, world!
winget upgrade hello-cli # 用于后续升级验证同时确认:
- GitHub Release 产物下载正常
hello --version输出与标签一致(例:v0.1.1)- README 安装示例同步更新
curl -fsSL .../install-latest.sh | sh -- --dry-run(或在容器中实际安装)通过
| 版本 | 功能 | 依赖 |
|---|---|---|
| v1.1.0 | 彩色 & Emoji 输出 | github.com/fatih/color |
| v1.2.0 | hello --name Alice |
标准库 flag |
| v2.0.0 | 自更新子命令 | go-update |
| v2.1.0 | Scoop / Chocolatey 自动发布 | GoReleaser 扩展 |
路线图保留原文,反映项目的长期规划。发布时请更新
docs/package-registry-status.md追踪各平台进度。
结合 docs/developer-onboarding.md、docs/versioning-policy.md 与
docs/winget-publishing-guide.md,此文档构成从开发到发布的全链路手册。