-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (64 loc) · 2.06 KB
/
release.yml
File metadata and controls
77 lines (64 loc) · 2.06 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
66
67
68
69
70
71
72
73
74
75
76
77
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Semver version (e.g. 0.1.0)"
required: true
permissions:
contents: write
run-name: Release v${{ github.event.inputs.version }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Validate version
run: |
VERSION="${{ github.event.inputs.version }}"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "❌ Invalid version: $VERSION"
exit 1
fi
- name: Set up git-cliff
uses: kenji-miyake/setup-git-cliff@v2
- name: Install just
uses: extractions/setup-just@v2
- name: Create release tag and commit
run: |
VERSION="${{ github.event.inputs.version}}"
echo "Creating release v$VERSION..."
just tag $VERSION
git push origin HEAD:main
git push origin v$VERSION
echo "✓ Release v$VERSION created and pushed"
- name: Generate release notes
id: changelog
run: |
VERSION="${{ github.event.inputs.version }}"
git cliff --latest --strip all --output RELEASE_NOTES.md
echo "Generated release notes for v$VERSION"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ github.event.inputs.version }}
name: v${{ github.event.inputs.version }}
body_path: RELEASE_NOTES.md
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}