-
-
Notifications
You must be signed in to change notification settings - Fork 480
363 lines (347 loc) · 12.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
name: Package
on:
push:
branches: [ master ]
tags-ignore: [ updater ]
jobs:
change-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.outputstep.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
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/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//g')" >> "$GITHUB_OUTPUT"
- name: Change Version for Windows
run: |
sed -i "s/\"version\":.*/\"version\": \"$(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//g')\",/g" package.json
sed -i "s/\"version\":.*/\"version\": \"$(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//g')\"/g" src-tauri/tauri.conf.json
sed -i "s/version = \"0.0.0\"/version = \"$(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//g')\"/g" src-tauri/Cargo.toml
echo $(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//g')
- name: Upload Artifacts for Windows
uses: actions/upload-artifact@v3
with:
name: source
path: ./*
if-no-files-found: error
build-extension:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build Popclipext
run: |
cd popclip
bash ./build.sh
cd ..
- name: Build SnipDo
run: |
cd snipdo
bash ./build.sh
cd ..
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Pot.popclipextz
path: popclip/Pot.popclipextz
if-no-files-found: error
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: pot.pbar
path: 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.TOKEN }}
files: popclip/Pot.popclipextz
- name: Upload Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG
token: ${{ secrets.TOKEN }}
files: 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@v3
with:
name: source
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: 19
- 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@v2
with:
version: 8
- 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@v3
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@v3
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.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.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@v3
with:
name: source
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: 19
- 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@v2
with:
version: 8
- 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@v3
with:
name: windows_${{ matrix.target }}
path: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*.exe*
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.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@v3
with:
name: source
- name: Build for Linux
uses: ./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@v3
with:
name: linux_${{ matrix.target }}_deb
path: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
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.TOKEN }}
files: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
release-update:
needs: [build-for-macos, build-for-windows, build-for-linux]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout repository
uses: actions/checkout@v3
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/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//g')" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//g')"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: pnpm install
run: pnpm install
- name: Release updater file
run: pnpm run updater
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
body: ${{env.VERSION}}
tag_name: updater
token: ${{ secrets.TOKEN }}
files: update.json
homebrew:
name: Update Homebrew cask
needs: build-for-macos
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout repository
uses: actions/checkout@v3
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/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//g')" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//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@v3
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/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//g')" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/.r.*//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