-
Notifications
You must be signed in to change notification settings - Fork 12
133 lines (128 loc) · 4.13 KB
/
release.yml
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: "Build and release"
on:
push:
tags:
- "v*"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Linux deps
run: |
sudo apt update
sudo apt install -y build-essential pkg-config libpcsclite-dev libgl1-mesa-dev xorg-dev
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "stable"
- name: Install Fyne
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Test
run: go test ./...
buildLinux:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Linux deps
run: |
sudo apt update
sudo apt install -y build-essential pkg-config libpcsclite-dev libgl1-mesa-dev xorg-dev
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "stable"
- name: Install Fyne
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Generate version file
run: |
VERSION=$(git describe --tags --abbrev=0 | tail -c +2)
echo "$VERSION" >> assets/version
echo " Version = \"$VERSION\"" >> FyneApp.toml
- name: Build GUI version
run: |
fyne package -os linux
mv 'Bas Celik.tar.xz' bas-celik.linux.amd64.tar.xz
- name: Upload GUI version
uses: actions/upload-artifact@v4
with:
name: linux-build-artifact
path: bas-celik.linux.amd64.tar.xz
- name: Build CLI version
run: |
echo -n "cli" >> assets/version
rm -R embed/translation
go build -tags "cli" -ldflags "-s -w" .
mv bas-celik bas-celik-cli.linux.amd64
- name: Upload CLI version
uses: actions/upload-artifact@v4
with:
name: linux-cli-build-artifact
path: bas-celik-cli.linux.amd64
buildWindows:
runs-on: windows-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "stable"
- name: Install Fyne
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Generate version file
run: |
$version = (git describe --tags --abbrev=0).Substring(1)
$version | Out-File -FilePath "assets/version" -Append
" Version = `"$version`"" | Out-File -FilePath "FyneApp.toml" -Append
- name: Build
run: |
fyne package -os windows
mv 'Bas Celik.exe' bas-celik.windows.amd64.exe
- name: Upload executables
uses: actions/upload-artifact@v4
with:
name: windows-build-artifact
path: bas-celik.windows.amd64.exe
release:
runs-on: ubuntu-latest
needs: [buildLinux, buildWindows]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Move files
run: |
mv linux-build-artifact/* .
mv linux-cli-build-artifact/* .
mv windows-build-artifact/* .
- name: Generate release body
run: |
touch changelog.md
git tag -l --format='%(contents)' ${{github.ref_name}} >> changelog.md
echo '' >> changelog.md
echo '```' >> changelog.md
sha256sum bas-celik.linux.amd64.tar.xz >> changelog.md
echo '```' >> changelog.md
echo '' >> changelog.md
echo '```' >> changelog.md
sha256sum bas-celik-cli.linux.amd64 >> changelog.md
echo '```' >> changelog.md
echo '' >> changelog.md
echo '```' >> changelog.md
sha256sum bas-celik.windows.amd64.exe >> changelog.md
echo '```' >> changelog.md
echo '' >> changelog.md
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
bas-celik.linux.amd64.tar.xz
bas-celik-cli.linux.amd64
bas-celik.windows.amd64.exe
body_path: changelog.md
tag_name: ${{github.ref_name}}