-
Notifications
You must be signed in to change notification settings - Fork 648
201 lines (187 loc) · 6.35 KB
/
dev.yaml
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
name: Dev Build
on:
workflow_dispatch:
schedule:
- cron: "15 0 * * *" # 每天 08:15 UTC+8 自动构建
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: short
jobs:
release:
strategy:
matrix:
targets:
- os: windows-latest
category: nsis # and portable
- os: windows-latest
category: msi
- os: ubuntu-latest
category: all
- os: macos-13
category: amd64
- os: macos-13
category: aarch64
runs-on: ${{ matrix.targets.os }}
if: startsWith(github.repository, 'keiko233')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: install Rust stable
run: rustup install stable --profile minimal && rustup default stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: "./backend/"
prefix-key: "rust-stable"
key: ${{ matrix.targets.os }}
shared-key: "release"
- name: Install the missing rust target (macOS Only)
if: startsWith(matrix.targets.os, 'macos-') && matrix.targets.category == 'aarch64'
run: |
rustup target add aarch64-apple-darwin
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "20"
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Delete current release assets
if: startsWith(matrix.targets.os, 'ubuntu-')
uses: mknejp/delete-release-assets@v1
with:
token: ${{ secrets.GH_TOKEN }}
tag: pre-release
fail-if-no-assets: false
fail-if-no-release: false
assets: |
*.zip
*.gz
*.AppImage
*.deb
*.dmg
*.msi
*.sig
*.exe
*.json
- name: Install Dependencies (Ubuntu Only)
if: startsWith(matrix.targets.os, 'ubuntu-')
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf openssl
- uses: maxim-lobanov/setup-xcode@v1
if: startsWith(matrix.targets.os, 'macos-')
with:
xcode-version: "15.0"
- name: Pnpm install and check
run: |
pnpm i
pnpm check
- name: Nightly Prepare
if: startsWith(matrix.targets.os, 'windows-') == false
run: |
pnpm prepare:nightly
- name: Nightly Prepare (MSI only)
if: startsWith(matrix.targets.os, 'windows-') && matrix.targets.category == 'msi'
run: |
pnpm prepare:nightly --msi
- name: Nightly Prepare (Windows NSIS and Portable)
if: startsWith(matrix.targets.os, 'windows-') && matrix.targets.category == 'nsis'
run: |
pnpm prepare:nightly --nsis
- name: Tauri build
if: startsWith(matrix.targets.os, 'macos-') == false || matrix.targets.category != 'aarch64'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
tagName: pre-release
releaseName: "Clash Nyanpasu Dev"
releaseBody: "More new features are now supported."
releaseDraft: false
prerelease: true
tauriScript: pnpm tauri
args: -f default-meta nightly -c ./backend/tauri/tauri.nightly.conf.json
- name: Portable Bundle (Windows Only)
if: startsWith(matrix.targets.os, 'windows-') && matrix.targets.category == 'nsis'
run: |
pnpm portable
env:
TAG_NAME: pre-release
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
VITE_WIN_PORTABLE: 1
- name: Pnpm check (macOS aarch64)
if: startsWith(matrix.targets.os, 'macos-') && matrix.targets.category == 'aarch64'
run: |
pnpm check --arch arm64 --sidecar-host aarch64-apple-darwin
- name: Tauri build with Upload (macOS aarch64)
if: startsWith(matrix.targets.os, 'macos-') && matrix.targets.category == 'aarch64'
env:
TAG_NAME: pre-release
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
run: |
pnpm build:nightly --target aarch64-apple-darwin
pnpm upload:osx-aarch64
update_tag:
name: Update tag
runs-on: ubuntu-latest
needs: [release]
if: startsWith(github.repository, 'keiko233')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Env
run: |
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
echo "CURRENT_GIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
shell: bash
- name: Update Tag
uses: greenhat616/update-tag@v1
with:
tag_name: pre-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
cat > release.txt << 'EOF'
## Clash Nyanpasu Nightly Build
Release created at ${{ env.BUILDTIME }}.
Daily build of **Clash Nyanpasu** on *dev* branch.
***[See the development log here](https://t.me/keikolog/462)***
EOF
- name: Update Release
uses: softprops/action-gh-release@v1
with:
name: Clash Nyanpasu Dev
tag_name: pre-release
body_path: release.txt
prerelease: true
generate_release_notes: true
target_commitish: dev
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
updater:
name: Update Nightly Updater
runs-on: ubuntu-latest
needs: [release, update_tag]
if: startsWith(github.repository, 'keiko233')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Pnpm install
run: pnpm i
- name: Update Updater
run: pnpm updater:nightly
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}