-
Notifications
You must be signed in to change notification settings - Fork 204
302 lines (259 loc) · 8.38 KB
/
Copy pathrelease.yml
File metadata and controls
302 lines (259 loc) · 8.38 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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
env:
GO_VERSION: "1.25.x"
NODE_VERSION: "24.x"
PNPM_VERSION: "11.1.3"
WAILS_VERSION: "v2.13.0"
jobs:
verify:
name: Verify release source
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- name: Verify Web
working-directory: web
run: |
pnpm install --frozen-lockfile
pnpm typecheck
pnpm test
pnpm build
- name: Verify Go
run: |
go test ./...
go test -tags bindings ./...
go vet ./...
- name: Lint GitHub Actions workflows
run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7 .github/workflows/*.yml
- name: Check patch formatting
run: git diff --check
server:
name: Server archives
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- name: Build server release archives
run: ./build.sh --release
- name: Upload server archives
uses: actions/upload-artifact@v4
with:
name: server-archives
path: |
build/*.tar.gz
build/*.zip
if-no-files-found: error
retention-days: 7
desktop:
name: Desktop ${{ matrix.name }}
needs: verify
strategy:
fail-fast: false
matrix:
include:
- name: Linux x64
os: ubuntu-22.04
platform: linux/amd64
artifact: simple-one-api-desktop-linux-x64.tar.gz
- name: Windows x64
os: windows-latest
platform: windows/amd64
artifact: simple-one-api-desktop-windows-x64.zip
- name: macOS x64
os: macos-14
platform: darwin/amd64
artifact: simple-one-api-desktop-macos-x64.zip
- name: macOS arm64
os: macos-14
platform: darwin/arm64
artifact: simple-one-api-desktop-macos-arm64.zip
runs-on: ${{ matrix.os }}
timeout-minutes: 35
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Linux desktop dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install --yes libgtk-3-dev libwebkit2gtk-4.0-dev
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- name: Install Wails
shell: bash
run: go install github.com/wailsapp/wails/v2/cmd/wails@"${WAILS_VERSION}"
- name: Build desktop application
working-directory: cmd/desktop
shell: bash
run: wails build -clean -platform ${{ matrix.platform }}
- name: Package Linux desktop application
if: runner.os == 'Linux'
run: tar -czf "${{ matrix.artifact }}" -C cmd/desktop/build/bin simple-one-api
- name: Package macOS desktop application
if: runner.os == 'macOS'
run: ditto -c -k --sequesterRsrc --keepParent cmd/desktop/build/bin/*.app "${{ matrix.artifact }}"
- name: Package Windows desktop application
if: runner.os == 'Windows'
shell: pwsh
run: Compress-Archive -Path cmd/desktop/build/bin/* -DestinationPath "${{ matrix.artifact }}"
- name: Upload desktop archive
uses: actions/upload-artifact@v4
with:
name: desktop-${{ matrix.artifact }}
path: ${{ matrix.artifact }}
if-no-files-found: error
retention-days: 7
container:
name: Publish multi-architecture container
needs: [verify, server]
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
packages: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Download server archives
uses: actions/download-artifact@v4
with:
name: server-archives
path: server-archives
- name: Prepare Linux binaries
run: |
mkdir -p build/linux-amd64 build/linux-arm64
tar -xzf server-archives/simple-one-api-linux-amd64.tar.gz -C build/linux-amd64
tar -xzf server-archives/simple-one-api-linux-arm64.tar.gz -C build/linux-arm64
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate container metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}
- name: Build and publish container image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
provenance: mode=max
sbom: true
publish:
name: Publish GitHub Release
needs: [server, desktop, container]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download server archives
uses: actions/download-artifact@v4
with:
name: server-archives
path: release-assets
- name: Download Linux desktop archive
uses: actions/download-artifact@v4
with:
name: desktop-simple-one-api-desktop-linux-x64.tar.gz
path: release-assets
- name: Download Windows desktop archive
uses: actions/download-artifact@v4
with:
name: desktop-simple-one-api-desktop-windows-x64.zip
path: release-assets
- name: Download macOS x64 desktop archive
uses: actions/download-artifact@v4
with:
name: desktop-simple-one-api-desktop-macos-x64.zip
path: release-assets
- name: Download macOS arm64 desktop archive
uses: actions/download-artifact@v4
with:
name: desktop-simple-one-api-desktop-macos-arm64.zip
path: release-assets
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
cd release-assets
sha256sum ./* > SHA256SUMS
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
gh release upload "${GITHUB_REF_NAME}" ./* --clobber
else
gh release create "${GITHUB_REF_NAME}" ./* \
--verify-tag \
--generate-notes \
--title "${GITHUB_REF_NAME}"
fi