-
-
Notifications
You must be signed in to change notification settings - Fork 489
453 lines (438 loc) · 19.7 KB
/
package.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
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
name: Package
on:
push:
branches: [master]
tags-ignore: [updater]
permissions: write-all
jobs:
change-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.outputstep.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git
- id: outputstep
run: |
echo "VERSION=$(git describe --tags | sed 's/-[0-9]*-.*//g')" >> "$GITHUB_OUTPUT"
- name: Change Version for Windows
run: |
sed -i "s/\"version\":.*/\"version\": \"$(git describe --tags | sed 's/-[0-9]*-.*//g')\",/g" package.json
sed -i "s/\"version\":.*/\"version\": \"$(git describe --tags | sed 's/-[0-9]*-.*//g')\"/g" src-tauri/tauri.conf.json
sed -i "s/version = \"0.0.0\"/version = \"$(git describe --tags | sed 's/-[0-9]*-.*//g')\"/g" src-tauri/Cargo.toml
echo $(git describe --tags | sed 's/-[0-9]*-.*//g')
- name: Upload Artifacts for Windows
uses: actions/upload-artifact@v4
with:
name: source
path: ./*
if-no-files-found: error
build-extension:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Popclipext
run: |
cd .scripts/popclip
bash ./build.sh
cd ../..
- name: Build SnipDo
run: |
cd .scripts/snipdo
bash ./build.sh
cd ../..
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Pot.popclipextz
path: .scripts/popclip/Pot.popclipextz
if-no-files-found: error
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: pot.pbar
path: .scripts/snipdo/pot.pbar
if-no-files-found: error
- name: Upload Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG
token: ${{ secrets.GITHUB_TOKEN }}
files: .scripts/popclip/Pot.popclipextz
- name: Upload Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG
token: ${{ secrets.GITHUB_TOKEN }}
files: .scripts/snipdo/pot.pbar
build-for-macos:
needs: change-version
strategy:
fail-fast: false
matrix:
platform: [macos-latest]
target: [aarch64-apple-darwin, x86_64-apple-darwin]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/download-artifact@v4
with:
name: source
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 21
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
- name: install dependencies
run: |
rustup target add ${{ matrix.target }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Dependencies
run: pnpm install
- name: Code Format
run: pnpm prettier --write .
- name: Build and Package
run: |
export TAURI_PRIVATE_KEY="${{ secrets.TAURI_PRIVATE_KEY }}"
export TAURI_KEY_PASSWORD="${{ secrets.TAURI_KEY_PASSWORD }}"
pnpm tauri build --target ${{ matrix.target }}
sudo chmod +x src-tauri/resources/*
chmod +x src-tauri/resources/*
- name: Change File Name
if: matrix.target == 'aarch64-apple-darwin'
run: |
sudo mv src-tauri/target/aarch64-apple-darwin/release/bundle/macos/pot.app.tar.gz src-tauri/target/aarch64-apple-darwin/release/bundle/macos/pot_${{needs.change-version.outputs.version}}_aarch64.app.tar.gz
sudo mv src-tauri/target/aarch64-apple-darwin/release/bundle/macos/pot.app.tar.gz.sig src-tauri/target/aarch64-apple-darwin/release/bundle/macos/pot_${{needs.change-version.outputs.version}}_aarch64.app.tar.gz.sig
- name: Change File Name
if: matrix.target == 'x86_64-apple-darwin'
run: |
sudo mv src-tauri/target/x86_64-apple-darwin/release/bundle/macos/pot.app.tar.gz src-tauri/target/x86_64-apple-darwin/release/bundle/macos/pot_${{needs.change-version.outputs.version}}_x64.app.tar.gz
sudo mv src-tauri/target/x86_64-apple-darwin/release/bundle/macos/pot.app.tar.gz.sig src-tauri/target/x86_64-apple-darwin/release/bundle/macos/pot_${{needs.change-version.outputs.version}}_x64.app.tar.gz.sig
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: macos_${{ matrix.target }}_dmg
path: src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg
if-no-files-found: error
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: macos_${{ matrix.target }}_updater
path: src-tauri/target/${{ matrix.target }}/release/bundle/macos/*.app*
if-no-files-found: error
- name: Upload Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG
token: ${{ secrets.GITHUB_TOKEN }}
files: src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg
- name: Upload Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG
token: ${{ secrets.GITHUB_TOKEN }}
files: src-tauri/target/${{ matrix.target }}/release/bundle/macos/*.app*
build-for-windows:
needs: change-version
strategy:
fail-fast: false
matrix:
platform: [windows-latest]
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc]
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
toolchain: stable-x86_64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
toolchain: stable-i686-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
toolchain: stable-aarch64-pc-windows-msvc
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/download-artifact@v4
with:
name: source
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 21
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
- name: install dependencies
run: |
rustup target add ${{ matrix.target }}
rustup toolchain install --force-non-host ${{ matrix.toolchain }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Dependencies
run: pnpm install
- name: Code Format
run: pnpm prettier --write .
- name: Build and Package
run: |
$env:TAURI_PRIVATE_KEY="${{ secrets.TAURI_PRIVATE_KEY }}"
$env:TAURI_KEY_PASSWORD="${{ secrets.TAURI_KEY_PASSWORD }}"
pnpm tauri build -b nsis,updater --target ${{ matrix.target }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: windows_${{ matrix.target }}
path: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
if-no-files-found: error
- name: Upload Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG
token: ${{ secrets.GITHUB_TOKEN }}
files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
build-for-windows-fix-runtime:
needs: change-version
strategy:
fail-fast: false
matrix:
platform: [windows-latest]
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc]
include:
- os: windows-latest
arch: x64
target: x86_64-pc-windows-msvc
toolchain: stable-x86_64-pc-windows-msvc
- os: windows-latest
arch: x86
target: i686-pc-windows-msvc
toolchain: stable-i686-pc-windows-msvc
- os: windows-latest
arch: arm64
target: aarch64-pc-windows-msvc
toolchain: stable-aarch64-pc-windows-msvc
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/download-artifact@v4
with:
name: source
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 21
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
- name: install dependencies
run: |
rustup target add ${{ matrix.target }}
rustup toolchain install --force-non-host ${{ matrix.toolchain }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Dependencies
run: pnpm install
- name: Code Format
run: pnpm prettier --write .
- name: Download WebView2 Runtime
run: |
invoke-webrequest -uri https://github.com/westinyang/WebView2RuntimeArchive/releases/download/109.0.1518.78/Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -outfile Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab
Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
Remove-Item .\src-tauri\tauri.windows.conf.json
Rename-Item .\src-tauri\webview.${{ matrix.arch }}.json tauri.windows.conf.json
- name: Build and Package
run: |
$env:TAURI_PRIVATE_KEY="${{ secrets.TAURI_PRIVATE_KEY }}"
$env:TAURI_KEY_PASSWORD="${{ secrets.TAURI_KEY_PASSWORD }}"
pnpm tauri build -b nsis,updater --target ${{ matrix.target }}
Rename-Item .\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\pot_${{needs.change-version.outputs.version}}_${{ matrix.arch }}-setup.exe pot_${{needs.change-version.outputs.version}}_${{ matrix.arch }}_fix_webview2_runtime-setup.exe
Rename-Item .\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\pot_${{needs.change-version.outputs.version}}_${{ matrix.arch }}-setup.nsis.zip pot_${{needs.change-version.outputs.version}}_${{ matrix.arch }}_fix_webview2_runtime-setup.nsis.zip
Rename-Item .\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\pot_${{needs.change-version.outputs.version}}_${{ matrix.arch }}-setup.nsis.zip.sig pot_${{needs.change-version.outputs.version}}_${{ matrix.arch }}_fix_webview2_runtime-setup.nsis.zip.sig
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: windows_fix_webview_runtime_${{ matrix.target }}
path: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
if-no-files-found: error
- name: Upload Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG
token: ${{ secrets.GITHUB_TOKEN }}
files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
build-for-linux:
needs: change-version
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
target:
[
x86_64-unknown-linux-gnu,
i686-unknown-linux-gnu,
aarch64-unknown-linux-gnu,
armv7-unknown-linux-gnueabihf,
]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
toolchain: stable-x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: i686-unknown-linux-gnu
toolchain: stable-i686-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
toolchain: stable-aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
toolchain: stable-armv7-unknown-linux-gnueabihf
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/download-artifact@v4
with:
name: source
- name: Build for Linux
uses: ./.github/actions/build-for-linux
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: linux_${{ matrix.target }}_deb
path: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
if-no-files-found: error
- name: Upload Artifacts
if: matrix.target == 'x86_64-unknown-linux-gnu'
uses: actions/upload-artifact@v4
with:
name: linux_${{ matrix.target }}_appimage
path: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
if-no-files-found: error
- name: Upload Release
if: startsWith(github.ref, 'refs/tags') && matrix.target == 'x86_64-unknown-linux-gnu'
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG
token: ${{ secrets.GITHUB_TOKEN }}
files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
- name: Upload Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG
token: ${{ secrets.GITHUB_TOKEN }}
files: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
release-update:
needs: [build-for-macos, build-for-windows, build-for-linux, build-for-windows-fix-runtime]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git curl
- name: Get Tag Name
run: |
echo "VERSION=$(git describe --tags | sed 's/-[0-9]*-.*//g')" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags | sed 's/-[0-9]*-.*//g')"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: pnpm install
run: pnpm install
- name: Release updater file
run: |
pnpm run updater
pnpm run updater:fixRuntime
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
body: ${{env.VERSION}}
tag_name: updater
token: ${{ secrets.GITHUB_TOKEN }}
files: |
update.json
update-fix-runtime.json
homebrew:
name: Update Homebrew cask
needs: build-for-macos
runs-on: macos-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Tag Name
run: |
echo "VERSION=$(git describe --tags | sed 's/-[0-9]*-.*//g')" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags | sed 's/-[0-9]*-.*//g')"
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Set up Git
run: |
# sudo apt-get install git -y
git config --global user.email [email protected]
git config --global user.name pot-app
- name: Update Homebrew cask
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.TOKEN }}
run: |
brew tap pot-app/homebrew-tap
brew update
brew bump-cask-pr pot --version ${{ env.VERSION }} --no-browse
winget:
name: Update WinGet Package
needs: build-for-windows
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git
- name: Get Tag Name
run: |
echo "VERSION=$(git describe --tags | sed 's/-[0-9]*-.*//g')" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags | sed 's/-[0-9]*-.*//g')"
- name: Upload WinGet
if: startsWith(github.ref, 'refs/tags')
uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: Pylogmon.pot
version: ${{env.VERSION}}
installers-regex: '\.exe$'
token: ${{ secrets.TOKEN }}
fork-user: Pylogmon
continue-on-error: true