66 - " **"
77 paths :
88 - " .github/workflows/install.yml"
9+ - " src/**"
10+ - " src-tauri/**"
11+ - " package.json"
12+ - " pnpm-lock.yaml"
13+ - " vite.config.ts"
914 - " assets/**"
1015 - " **.py"
1116 pull_request :
1217 branches :
1318 - " **"
1419 paths :
1520 - " .github/workflows/install.yml"
21+ - " src/**"
22+ - " src-tauri/**"
23+ - " package.json"
24+ - " pnpm-lock.yaml"
25+ - " vite.config.ts"
1626 - " assets/**"
1727 - " **.py"
1828 workflow_dispatch :
1929
2030env :
2131 MAA_FRAMEWORK_VERSION : " v5.10.2"
22- MFAA_VERSION : " v2.12.0"
2332
2433permissions :
2534 contents : write
@@ -34,14 +43,12 @@ jobs:
3443 fetch-depth : 0
3544 - id : set_tag
3645 run : |
37- # 检查标签格式
3846 if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?$ ]]; then
3947 is_release=true
4048 tag=${GITHUB_REF#refs/tags/}
4149 echo "Release tag format is valid: $tag"
4250 else
4351 is_release=false
44- # 获取最新的发布标签
4552 tag=$(curl -sX GET "https://api.github.com/repos/${{ github.repository }}/releases/latest" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | awk '/tag_name/{print $4}' FS='["]')
4653 if [[ ! $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then
4754 echo "No valid release tag found, using v0.0.1"
5663 tag="$prefix-ci.$suffix"
5764 fi
5865
59- # 检查是否为预发布版本
6066 is_prerelease=false
6167 if [[ $tag =~ .*alpha.* || $tag =~ .*beta.* || $tag =~ .*rc.* || $tag =~ .*dev.* || $tag =~ .*-ci.* || $tag =~ .*preview.* ]]; then
6268 is_prerelease=true
63- echo "This is a pre-release version"
6469 fi
6570
6671 echo tag=$tag | tee -a $GITHUB_OUTPUT
@@ -75,78 +80,86 @@ jobs:
7580 needs : meta
7681 strategy :
7782 matrix :
78- include :
79- - arch : x86_64
80- runner : windows-latest
83+ arch : [x86_64, aarch64]
8184 fail-fast : false
82- runs-on : ${{ matrix.runner }}
85+ runs-on : windows-latest
8386
8487 steps :
8588 - uses : actions/checkout@v4
8689 with :
8790 submodules : true
8891
89- - name : Set platform variables
90- id : platform
91- shell : bash
92- run : |
93- if [ "${{ matrix.arch }}" = "x86_64" ]; then
94- echo "tag=x64" >> $GITHUB_OUTPUT
95- else
96- echo "tag=arm64" >> $GITHUB_OUTPUT
97- fi
92+ - name : Setup pnpm
93+ uses : pnpm/action-setup@v4
9894
99- - name : Download MaaFramework
100- uses : robinraju/release-downloader@v1
95+ - name : Setup Node.js
96+ uses : actions/setup-node@v4
10197 with :
102- repository : MaaXYZ/MaaFramework
103- fileName : " MAA-win-${{ matrix.arch }}*"
104- tag : ${{ env.MAA_FRAMEWORK_VERSION }}
105- out-file-path : " deps"
106- extract : true
98+ node-version : 20
99+ cache : " pnpm"
107100
108- - name : Download MFAAvalonia
109- id : download_mfa
110- uses : robinraju/release-downloader@v1
101+ - name : Setup Rust
102+ uses : dtolnay/rust-toolchain@stable
111103 with :
112- repository : MaaXYZ/MFAAvalonia
113- fileName : " MFAAvalonia-*-win-${{ steps.platform.outputs.tag }}*"
114- tag : ${{ env.MFAA_VERSION }}
115- out-file-path : " MFA"
116- extract : true
104+ targets : ${{ matrix.arch == 'x86_64' && 'x86_64-pc-windows-msvc' || 'aarch64-pc-windows-msvc' }}
105+
106+ - name : Setup sccache
107+ uses : mozilla-actions/sccache-action@v0.0.9
108+
109+ - name : Rust cache
110+ uses : swatinem/rust-cache@v2
111+ with :
112+ workspaces : " src-tauri -> target"
113+ shared-key : " windows-${{ matrix.arch }}"
114+ cache-on-failure : true
115+
116+ - name : Install frontend dependencies
117+ run : pnpm install
117118
118- - name : Clean up MFAAvalonia archive on Windows
119+ - name : Update version
119120 shell : bash
120121 run : |
121- ARCHIVE_FILE_PATH="${{ fromJson(steps.download_mfa.outputs.downloaded_files)[0] }}"
122- rm -f "${ARCHIVE_FILE_PATH}"
123- echo "Archive cleanup command executed for MFAAvalonia on Windows."
122+ VERSION="${{ needs.meta.outputs.tag }}"
123+ VERSION_NUM="${VERSION#v}"
124+ sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION_NUM\"/" package.json
125+ sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION_NUM\"/" src-tauri/tauri.conf.json
126+ sed -i "s/^version = \"[^\"]*\"/version = \"$VERSION_NUM\"/" src-tauri/Cargo.toml
127+ echo "Updated version to $VERSION_NUM"
124128
125129 - name : Convert PNG to ICO
126130 if : matrix.arch == 'x86_64'
127131 shell : bash
128132 run : |
129- # 安装 ImageMagick
130133 choco install imagemagick -y
134+ mkdir -p src-tauri/icons
135+ magick convert assets/logo.png -define icon:auto-resize=256,128,64,48,32,24,16 src-tauri/icons/icon.ico
131136
132- # 转换 PNG 到 ICO
133- magick convert assets/logo.png -define icon:auto-resize=256,128,64,48,32,24,16 maante.ico
137+ - name : Build Tauri app
138+ env :
139+ CARGO_INCREMENTAL : 0
140+ RUSTC_WRAPPER : sccache
141+ SCCACHE_GHA_ENABLED : " true"
142+ run : pnpm tauri build --bundles nsis --target ${{ matrix.arch == 'x86_64' && 'x86_64-pc-windows-msvc' || 'aarch64-pc-windows-msvc' }}
134143
135- - name : Modify Windows exe icons
136- if : matrix.arch == 'x86_64'
144+ - name : Set platform variables
145+ id : platform
137146 shell : bash
138147 run : |
139- # 下载 rcedit
140- curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit.exe
141-
142- # 修改 MFAAvalonia 图标(如果存在)
143- if [ -f "MFA/MFAAvalonia.exe" ]; then
144- ./rcedit.exe "MFA/MFAAvalonia.exe" --set-icon "maante.ico"
145- echo "MFAAvalonia icon modified successfully"
148+ if [ "${{ matrix.arch }}" = "x86_64" ]; then
149+ echo "tag=x64" >> $GITHUB_OUTPUT
146150 else
147- echo "MFAAvalonia exe not found, skipping icon update."
151+ echo "tag=arm64" >> $GITHUB_OUTPUT
148152 fi
149153
154+ - name : Download MaaFramework
155+ uses : robinraju/release-downloader@v1
156+ with :
157+ repository : MaaXYZ/MaaFramework
158+ fileName : " MAA-win-${{ matrix.arch }}*"
159+ tag : ${{ env.MAA_FRAMEWORK_VERSION }}
160+ out-file-path : " deps"
161+ extract : true
162+
150163 - name : Setup Embed Python on Windows
151164 shell : bash
152165 run : |
@@ -157,46 +170,23 @@ jobs:
157170 run : |
158171 ./install/python/python.exe tools/ci/download_deps.py --deps-dir install/deps
159172
160- - name : Install
173+ - name : Copy Tauri build output
161174 shell : bash
162175 run : |
163- PLATFORM_TAG="win-${{ steps.platform.outputs.tag }}"
164- ./install/python/python.exe ./tools/ci/install.py ${{ needs.meta.outputs.tag }} $PLATFORM_TAG
176+ TARGET_DIR="src-tauri/target/${{ matrix.arch == 'x86_64' && 'x86_64-pc-windows-msvc' || 'aarch64-pc-windows-msvc' }}/release"
177+ cp -r "$TARGET_DIR/bundle/nsis/"*.exe install/ || true
178+ cp -r "$TARGET_DIR/bundle/resources/"* install/ || true
179+ echo "Copied Tauri build output to install/"
165180
166- - name : Copy MFA files to main version
181+ - name : Install Python agent
167182 shell : bash
168183 run : |
169- if [ -d "MFA" ]; then
170- echo "Copying MFA files to install directory..."
171- mkdir -p install
172- cp -rpvn MFA/. install/
173- if [ -f "install/MFAAvalonia.exe" ]; then
174- mv -f install/MFAAvalonia.exe install/MaaNTE.exe
175- elif [ -f "install/MFAAvalonia" ]; then
176- mv -f install/MFAAvalonia install/MaaNTE
177- fi
178- else
179- echo "MFA directory not found, skipping copy."
180- fi
181-
182- - name : Copy custom icons
183- shell : bash
184- run : |
185- # 删除 MFAA 自带的 Assets 文件夹
186- if [ -d "install/Assets" ]; then
187- rm -rf install/Assets
188- echo "Removed original Assets folder"
189- fi
190-
191- # MFAA 版本的图标放根目录
192- if [ -f "maante.ico" ]; then
193- cp maante.ico install/logo.ico
194- echo "Copied custom icon to install/logo.ico"
195- fi
184+ PLATFORM_TAG="win-${{ steps.platform.outputs.tag }}"
185+ ./install/python/python.exe ./tools/ci/install.py ${{ needs.meta.outputs.tag }} $PLATFORM_TAG
196186
197187 - uses : actions/upload-artifact@v4
198188 with :
199- name : MaaNTE-win-${{ matrix.arch }}-${{ needs.meta.outputs.tag }}-MFAA
189+ name : MaaNTE-win-${{ matrix.arch }}-${{ needs.meta.outputs.tag }}
200190 path : " install"
201191
202192 changelog :
@@ -216,8 +206,6 @@ jobs:
216206 id : git-cliff
217207 with :
218208 config : .github/cliff.toml
219- # 正式版:使用 tag-pattern 只匹配正式版标签,包含所有从上一个正式版以来的提交
220- # 预发布版:正常生成,只包含从上一个标签以来的提交
221209 args : >-
222210 -vv --latest --strip header
223211 ${{ needs.meta.outputs.is_prerelease == 'false' && '--tag-pattern "^v[0-9]+\\.[0-9]+\\.[0-9]+$"' || '' }}
@@ -241,24 +229,6 @@ jobs:
241229 if [[ $f == *"win"* ]]; then
242230 (cd "$f" && zip -r "../$f.zip" .)
243231 else
244- echo "Processing Unix artifact: $f"
245-
246- if [[ -f "$f/MaaPiCli" ]]; then
247- chmod +x "$f/MaaPiCli"
248- echo "Set execute permission for $f/MaaPiCli"
249- fi
250-
251- find "$f" -type f -name "MFAAvalonia*" -exec chmod +x {} \; 2>/dev/null || true
252- echo "Set execute permission for all MFAAvalonia files"
253-
254- find "$f" -type f -name "MFAUpdater*" -exec chmod +x {} \; 2>/dev/null || true
255- echo "Set execute permission for all MFAUpdater files"
256-
257- if [[ -f "$f/MaaNTE" ]]; then
258- chmod +x "$f/MaaNTE"
259- echo "Set execute permission for $f/MaaNTE"
260- fi
261-
262232 PYTHON_PATHS=(
263233 "$f/python/bin/python3"
264234 "$f/python/python"
@@ -268,12 +238,9 @@ jobs:
268238 for PYTHON_PATH in "${PYTHON_PATHS[@]}"; do
269239 if [[ -f "$PYTHON_PATH" ]]; then
270240 chmod +x "$PYTHON_PATH"
271- echo "Set execute permission for $PYTHON_PATH"
272241 fi
273242 done
274-
275243 tar -cpzf "$f.tar.gz" -C "$f" .
276- echo "Created archive with preserved permissions: $f.tar.gz"
277244 fi
278245 done
279246
0 commit comments