-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (54 loc) · 1.49 KB
/
Copy pathrelease.yml
File metadata and controls
64 lines (54 loc) · 1.49 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
description: "要发布的 tag (如 v0.1.0)"
required: true
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
goreleaser:
name: Goreleaser
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: 检出指定 tag (workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: git checkout "${{ inputs.tag }}"
- name: 安装 git-cliff
uses: taiki-e/install-action@v2
with:
tool: git-cliff
- name: 生成 changelog (latest tag only)
run: |
git-cliff --config cliff.toml --latest --strip all -o CHANGELOG_LATEST.md
echo "--- generated release notes ---"
cat CHANGELOG_LATEST.md
- name: 运行 goreleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean --release-notes=CHANGELOG_LATEST.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 上传 dist 工件 (调试用)
if: failure()
uses: actions/upload-artifact@v5
with:
name: dist-debug
path: dist/
retention-days: 7