-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (74 loc) · 2.09 KB
/
release.yml
File metadata and controls
87 lines (74 loc) · 2.09 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
78
79
80
81
82
83
84
85
86
87
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v1.0.0)'
required: true
type: string
permissions:
contents: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set release tag
id: set-tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ github.event.inputs.tag }}"
echo "Creating tag $TAG"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "$TAG"
git push origin "$TAG"
else
TAG="${{ github.ref_name }}"
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.25.7"
cache: true
cache-dependency-path: go.sum
- name: Verify build
run: |
go mod download
go build ./...
go test -race -count=1 ./...
- name: Generate release notes
id: notes
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -z "$PREV_TAG" ]; then
NOTES=$(git log --pretty=format:"- %s (%h)" HEAD)
else
NOTES=$(git log --pretty=format:"- %s (%h)" ${PREV_TAG}..HEAD)
fi
{
echo "notes<<EOF"
echo "$NOTES"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.set-tag.outputs.tag }}
body: |
## Changes
${{ steps.notes.outputs.notes }}
---
### Installation
```bash
go get github.com/xraph/sentinel@${{ steps.set-tag.outputs.tag }}
```
generate_release_notes: true