-
Notifications
You must be signed in to change notification settings - Fork 602
153 lines (134 loc) · 5.52 KB
/
deps-build-linux.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
name: "[Single] Build Linux"
on:
workflow_dispatch:
inputs:
nightly:
description: "Nightly prepare"
required: true
type: boolean
default: false
tag:
description: "Release Tag"
required: true
type: string
aarch64:
description: "Build for aarch64"
required: false
type: boolean
default: false
workflow_call:
inputs:
nightly:
description: "Nightly prepare"
required: true
type: boolean
default: false
tag:
description: "Release Tag"
required: true
type: string
aarch64:
description: "Build for aarch64"
required: false
type: boolean
default: false
jobs:
build:
runs-on: ubuntu-22.04 # 需要手动升级到 24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust stable
run: |
rustup install stable --profile minimal --no-self-update
rustup default stable
- name: Setup aarch64 Toolchain
if: ${{ inputs.aarch64 == true }}
run: |
rustup target add aarch64-unknown-linux-gnu
sudo apt install gcc-aarch64-linux-gnu -y
sudo dpkg --add-architecture arm64
cat <<EOF
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy universe
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates universe
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy multiverse
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates multiverse
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security universe
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security multiverse
EOF | sudo tee /etc/apt/sources.list.d/arm64.list
sudo apt update -y && sudo apt upgrade -y
sudo apt install libwebkit2gtk-4.0-dev:arm64 libgtk-3-dev:arm64 libappindicator3-dev:arm64 librsvg2-dev:arm64 patchelf:arm64 openssl:arm64 -y
- uses: Swatinem/rust-cache@v2
with:
workspaces: "./backend/"
prefix-key: "rust-stable"
key: ubuntu-latest
shared-key: "release"
- name: Install Node latest
uses: actions/setup-node@v4
with:
node-version: latest
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf openssl
- name: Pnpm install deps and download resources
run: |
pnpm i
${{ inputs.aarch64 == true && 'pnpm check --arch arm64 --sidecar-host aarch64-apple-darwin' || 'pnpm check' }}
- name: Nightly Prepare
if: ${{ inputs.nightly == true }}
run: |
pnpm prepare:nightly
- name: Build UI
run: |
pnpm -F ui build
- name: Tauri build
uses: tauri-apps/tauri-action@v0
if: ${{ inputs.aarch64 == false }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
NIGHTLY: ${{ inputs.nightly == true && 'true' || 'false' }}
with:
tagName: ${{ inputs.tag }}
releaseName: "Clash Nyanpasu Dev"
releaseBody: "More new features are now supported."
releaseDraft: false
prerelease: true
tauriScript: pnpm tauri
args: ${{ inputs.nightly == true && '-f nightly -c ./backend/tauri/tauri.nightly.conf.json' || '-f default-meta -c ./backend/tauri/tauri.conf.json' }}
- name: Tauri build and upload (aarch64)
if: ${{ inputs.aarch64 == true }}
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
NIGHTLY: ${{ inputs.nightly == true && 'true' || 'false' }}
run: |
${{ inputs.nightly == true && 'pnpm build:nightly --target aarch64-unknown-linux-gnu -b "rpm,deb,updater"' || 'pnpm build --target aarch64-unknown-linux-gnu -b "rpm,deb,updater"' }}
gh release upload ${{ inputs.tag }} ./backend/target/release/bundle/*.deb ./backend/target/release/bundle/*.rpm --clobber
- name: Calc the archive signature
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${{ inputs.tag }}
find ./backend/target/release/bundle \( -name "*.deb" -o -name "*.rpm" \) | while read file; do
sha_file="$file.sha256"
if [[ ! -f "$sha_file" ]]; then
sha256sum "$file" > "$sha_file"
echo "Created checksum file for: $file"
fi
gh release upload $TAG_NAME "$sha_file" --clobber
echo "Uploaded $sha_file to release $TAG_NAME"
done