Goreleaser Release App in Github
建议点击 查看原文 查看最新内容。
原文链接:
https://typonotes.com/posts/2025/05/19/goreleaser-release-app-in-github/
项目可以通过 renovate-bot 进行以来变更管理, 当依赖内容变化后, 可以帮助我们创建 PR。
https://github.com/tangxin/k8s-image-syncer/pulls

goreleaser 可以为 go 项目快速发布 Release 页面。 这对管理项目变更非常重要。 尤其是对于 go library 的依赖而言, 尤为重要。 当创建 PR 的时候, 可以携带所依赖库的 ChangeLog 内容, 帮助我们快速了解依赖的变化内容。

Goreleaser
Goreleaser
是一款专门针对 Go 语言的 编译、发布管理工具。 采用 开源(功能限制) + 专业版 的收费模式。
- 执行命令后, 会在本地生成一个
.goreleaser.yaml
的配置文件
- 配置管理
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| # This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 2
builds:
- skip: true # library package, 没有 main.go, 不需要编译
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
release:
footer: >-
---
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
|
- 发布 GitHub Release 内容
当所有变更都提交、 打完 tag
后。 可以运行以下命令发布
1
2
| export GITHUB_TOKEN=xxxx
goreleaser release
|
Github Action 自动发布
如果需要 Github Action 自动发布, 则需要配置 .github/workflows/goreleaser_action.yml
如下。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| name: Goreleaser
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.ACTION_GITHUB_TOKEN }}
|