-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (91 loc) · 2.83 KB
/
release.yml
File metadata and controls
109 lines (91 loc) · 2.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Release
on:
workflow_dispatch:
inputs:
version_bump:
description: 'Version bump type'
type: choice
required: true
default: 'minor'
options:
- major
- minor
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Latest Tag
run: |
latest=$(git describe --tags $(git rev-list --tags --max-count=1) || echo "v0.00")
if ! [[ $latest =~ ^v?[0-9]+\.[0-9]{2,3}$ ]]; then
echo "Error: Tag format is invalid. Expected format: vX.XX"
exit 1
fi
echo "Latest tag: $latest"
echo "latest=$latest" >> $GITHUB_ENV
- name: Check for changes since last release
run: |
if [ "${{ env.latest }}" != "v0.00" ]; then
if [ -z "$(git diff --name-only ${{ env.latest }})" ]; then
echo "No changes detected since last release"
exit 1
fi
fi
- name: Calculate next version
run: |
latest="${latest:-v0.00}"
version="${latest#v}"
IFS='.' read -r major minor <<< "$version"
echo "Previous: major=$major, minor=$minor"
if [[ "${{ github.event.inputs.version_bump }}" == "major" ]]; then
major=$((major + 1))
minor=0
else
minor=$((10#$minor + 1)) # avoid octal
fi
new_minor=$(printf "%02d" "$minor")
new_tag="v$major.$new_minor"
echo "New version: $new_tag"
echo "new_tag=$new_tag" >> $GITHUB_ENV
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
- name: Create and Push Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ env.new_tag }} -a -m "Release ${{ env.new_tag }}"
git push origin ${{ env.new_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install native dependencies (GTK + GCC + libc)
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libc6-dev \
libgtk-3-dev \
libglib2.0-dev \
libgtk-layer-shell-dev \
gcc \
g++ \
gcc-multilib \
pkg-config
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CGO_ENABLED: 1
CC: gcc
CXX: g++