-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (55 loc) · 1.81 KB
/
cd.yml
File metadata and controls
65 lines (55 loc) · 1.81 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
65
name: CD
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (format: x.y.z)'
required: true
type: string
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install git-chglog
run: |
CHGLOG_VERSION="0.15.4"
wget -O /tmp/git-chglog.tar.gz https://github.com/git-chglog/git-chglog/releases/download/v${CHGLOG_VERSION}/git-chglog_${CHGLOG_VERSION}_linux_amd64.tar.gz
cd /tmp && tar xzf git-chglog.tar.gz
sudo mv git-chglog /usr/local/bin/
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25.0'
- name: Validate version format
run: |
if ! echo "${{ github.event.inputs.version }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Invalid version format. Must be x.y.z"
exit 1
fi
- name: Generate changelog
run: |
git-chglog --output CHANGELOG.md --next-tag "v${{ github.event.inputs.version }}"
- name: Commit changelog
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Actions"
git add CHANGELOG.md
git commit -m "chore: update changelog"
git push
- name: Create tag
run: |
git tag "v${{ github.event.inputs.version }}"
git push origin "v${{ github.event.inputs.version }}"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}