-
-
Notifications
You must be signed in to change notification settings - Fork 83
204 lines (164 loc) · 6.06 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Based partially on Alyxia's work, thanks so much!
name: Release
on:
push:
tags:
- v*
env:
FORCE_COLOR: true
jobs:
build-linux:
runs-on: ubuntu-20.04 # hopefully older glibc for better compatibility on systems like debian bullseye
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Go dependencies
run: go get -v
- name: Build Cli
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -tags "static cli" -ldflags "-s -w -X 'vencordinstaller/buildinfo.InstallerGitHash=$(git rev-parse --short HEAD)' -X 'vencordinstaller/buildinfo.InstallerTag=${{ github.ref_name }}'" -o VencordInstallerCli-linux
- name: Update executable
run: |
chmod +x VencordInstallerCli-linux
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: VencordInstaller-linux
path: |
VencordInstallerCli-linux
build-mac:
runs-on: macos-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- id: go-cache-paths
run: |
echo "go_build=$(go env GOCACHE)" >> $GITHUB_ENV
echo "go_mod=$(go env GOMODCACHE)" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: brew install pkg-config sdl2
- name: Install Go dependencies
run: go get -v
- name: Build
run: CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -tags static -ldflags "-s -w -X 'vencordinstaller/buildinfo.InstallerGitHash=$(git rev-parse --short HEAD)' -X 'vencordinstaller/buildinfo.InstallerTag=${{ github.ref_name }}'" -o VencordInstaller
- name: Update executable
run: |
chmod +x VencordInstaller
- name: Generate MacOS bundle
run: |
mkdir -p VencordInstaller.app/Contents/MacOS
mkdir -p VencordInstaller.app/Contents/Resources
cp macos/Info.plist VencordInstaller.app/Contents/Info.plist
mv VencordInstaller VencordInstaller.app/Contents/MacOS/VencordInstaller
cp macos/icon.icns VencordInstaller.app/Contents/Resources/icon.icns
zip -r VencordInstaller.MacOS.zip VencordInstaller.app
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: VencordInstaller-macos
path: VencordInstaller.MacOS.zip
build-windows:
runs-on: windows-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
- name: Install Windows dependencies
shell: msys2 {0}
run: |
pacman -S --noconfirm git mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-go
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
- name: Install Go dependencies
shell: msys2 {0}
run: |
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
go get -v
go install github.com/tc-hib/go-winres@latest
- name: Build Gui
shell: msys2 {0}
run: |
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
go-winres make --product-version "git-tag"
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v -tags static -ldflags "-s -w -H=windowsgui -extldflags=-static -X 'vencordinstaller/buildinfo.InstallerGitHash=$(git rev-parse --short HEAD)' -X 'vencordinstaller/buildinfo.InstallerTag=${{ github.ref_name }}'" -o VencordInstaller.exe
- name: Build i386 Cli
shell: msys2 {0}
run: |
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -v -tags "static cli" -ldflags "-s -w -extldflags=-static -X 'vencordinstaller/buildinfo.InstallerGitHash=$(git rev-parse --short HEAD)' -X 'vencordinstaller/buildinfo.InstallerTag=${{ github.ref_name }}'" -o VencordInstallerCli.exe
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: VencordInstaller-windows
path: |
VencordInstaller.exe
VencordInstallerCli.exe
release:
runs-on: ubuntu-latest
needs: [build-linux, build-mac, build-windows]
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: VencordInstaller-linux
path: linux
- uses: actions/download-artifact@v3
with:
name: VencordInstaller-macos
path: macos
- uses: actions/download-artifact@v3
with:
name: VencordInstaller-windows
path: windows
- name: Create the release
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref_name }}
prerelease: false
draft: false
files: |
linux/VencordInstallerCli-linux
macos/VencordInstaller.MacOS.zip
windows/VencordInstalle*.exe