-
Notifications
You must be signed in to change notification settings - Fork 5
69 lines (58 loc) · 1.83 KB
/
release.yml
File metadata and controls
69 lines (58 loc) · 1.83 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
name: Release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if tag is on master branch
run: |
if [[ "${{ github.ref_type }}" != "tag" ]]; then
echo "Not a tag, skipping release"
exit 1
fi
# Get the commit that the tag points to
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})
# Check if this commit is on master branch
if ! git branch -r --contains $TAG_COMMIT | grep -q "origin/master"; then
echo "Tag ${{ github.ref_name }} is not on master branch, skipping release"
exit 1
fi
echo "Tag ${{ github.ref_name }} is on master branch, proceeding with release"
- name: Get version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.0"
- name: Set version file
run: |
echo "${{ steps.version.outputs.version }}" > cmd/version.txt
- name: Build binaries for all platforms
run: |
make build-all
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Release ${{ steps.version.outputs.tag }}
draft: false
prerelease: false
generate_release_notes: true
files: |
bin/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}