1919 - " **.py"
2020 workflow_dispatch :
2121
22+ permissions :
23+ contents : write
24+ actions : write
25+
2226jobs :
2327 meta :
2428 runs-on : ubuntu-latest
@@ -42,19 +46,25 @@ jobs:
4246 suffix=${tag#$prefix-}
4347 tag="$prefix-ci.$suffix"
4448 fi
49+ is_prerelease=false
50+ if [[ $tag =~ .*alpha.* || $tag =~ .*beta.* || $tag =~ .*rc.* || $tag =~ .*dev.* || $tag =~ .*-ci.* ]]; then
51+ is_prerelease=true
52+ fi
4553
4654 echo tag=$tag | tee -a $GITHUB_OUTPUT
4755 echo is_release=$is_release | tee -a $GITHUB_OUTPUT
56+ echo is_prerelease=$is_prerelease | tee -a $GITHUB_OUTPUT
4857 outputs :
4958 tag : ${{ steps.set_tag.outputs.tag }}
5059 is_release : ${{ steps.set_tag.outputs.is_release }}
60+ is_prerelease : ${{ steps.set_tag.outputs.is_prerelease }}
5161
5262 windows :
5363 needs : meta
5464 runs-on : windows-latest
5565 strategy :
5666 matrix :
57- arch : [aarch64, x86_64]
67+ arch : [x86_64]
5868 fail-fast : false
5969
6070 steps :
@@ -68,23 +78,29 @@ jobs:
6878 repository : MaaXYZ/MaaFramework
6979 fileName : " MAA-win-${{ matrix.arch }}*"
7080 latest : true
81+ preRelease : true
7182 out-file-path : " deps"
7283 extract : true
73-
84+
7485 - name : Download MFAAvalonia
7586 uses : robinraju/release-downloader@v1
76- with :
87+ with :
7788 repository : SweetSmellFox/MFAAvalonia
78- filename : MFAAvalonia*
79- latest : true
80- out-file-path : " MFA"
81- extract : true
89+ fileName : " MFAAvalonia-*-win-x64*"
90+ latest : true
91+ out-file-path : " MFA"
92+ extract : true
93+
94+ - name : Setup Embed Python
95+ shell : powershell
96+ run : |
97+ ./tools/ci/setup_embed_python.ps1
8298
8399 - name : Install
84100 shell : bash
85101 run : |
86- python ./install.py ${{ needs.meta.outputs.tag }}
87- cp MFA/MFAAvalonia.exe install
102+ python ./tools/ install.py ${{ needs.meta.outputs.tag }}
103+ cp MFA/MFAAvalonia.exe MFA/MFAUpdater.exe MFA/MFAUpdater.dll MFA/MFAUpdater.runtimeconfig.json MFA/av_libglesv2.dll MFA/libHarfBuzzSharp.dll MFA/libonigwrap.dll MFA/libSkiaSharp.dll MFA/uiohook.dll install/
88104 mv install/MFAAvalonia.exe install/MaaJR.exe
89105 cp logo.ico install
90106
@@ -93,11 +109,12 @@ jobs:
93109 name : MaaJR-win-${{ matrix.arch }}
94110 path : " install"
95111
96- ubuntu :
112+ unix :
97113 needs : meta
98- runs-on : ubuntu-latest
114+ runs-on : ${{ matrix.os }}
99115 strategy :
100116 matrix :
117+ os : [ubuntu-latest, macos-latest]
101118 arch : [aarch64, x86_64]
102119 fail-fast : false
103120
@@ -110,103 +127,111 @@ jobs:
110127 uses : robinraju/release-downloader@v1
111128 with :
112129 repository : MaaXYZ/MaaFramework
113- fileName : " MAA-linux-${{ matrix.arch }}*"
130+ fileName : " MAA-${{ matrix.os == 'ubuntu-latest' && ' linux' || 'macos' }} -${{ matrix.arch }}*"
114131 latest : true
132+ preRelease : true
115133 out-file-path : " deps"
116134 extract : true
117135
118- - name : Install
119- shell : bash
120- run : |
121- python ./install.py ${{ needs.meta.outputs.tag }}
122-
123- - uses : actions/upload-artifact@v4
124- with :
125- name : MaaJR-linux-${{ matrix.arch }}
126- path : " install"
127-
128- macos :
129- needs : meta
130- runs-on : macos-latest
131- strategy :
132- matrix :
133- arch : [aarch64, x86_64]
134- fail-fast : false
135-
136- steps :
137- - uses : actions/checkout@v4
138- with :
139- submodules : true
140-
141- - name : Download MaaFramework
142- uses : robinraju/release-downloader@v1
136+ - name : Download MFAAvalonia
137+ uses : robinraju/release-downloader@v1
143138 with :
144- repository : MaaXYZ/MaaFramework
145- fileName : " MAA-macos -${{ matrix.arch }}*"
139+ repository : SweetSmellFox/MFAAvalonia
140+ fileName : " MFAAvalonia-* -${{ matrix.os == 'ubuntu-latest' && 'linux' || 'osx' }}-${{ matrix. arch == 'x86_64' && 'x64' || 'arm64' }}*"
146141 latest : true
147- out-file-path : " deps "
142+ out-file-path : " MFA "
148143 extract : true
149144
150145 - name : Install
151146 shell : bash
152147 run : |
153- python ./install.py ${{ needs.meta.outputs.tag }}
148+ python ./tools/install.py ${{ needs.meta.outputs.tag }}
149+ platform_name="${{ matrix.os == 'ubuntu-latest' && 'linux' || 'macos' }}"
150+
151+ # Create list of MFA files to copy
152+ mfa_files=$(ls -A MFA)
153+
154+ # Copy MFA files to install directory, skipping if they already exist
155+ for file in $mfa_files; do
156+ cp -n MFA/$file install/ 2>/dev/null || true
157+ done
154158
155159 - uses : actions/upload-artifact@v4
156160 with :
157- name : MaaJR-macos-${{ matrix.arch }}
161+ name : MaaJR-${{ matrix.os == 'ubuntu-latest' && 'linux' || ' macos' }} -${{ matrix.arch }}
158162 path : " install"
159163
160- android :
161- needs : meta
162- runs-on : macos-latest
163- strategy :
164- matrix :
165- arch : [aarch64, x86_64]
166- fail-fast : false
167-
164+ changelog :
165+ name : Generate changelog
166+ runs-on : ubuntu-latest
167+ outputs :
168+ release_body : ${{ steps.git-cliff.outputs.content }}
168169 steps :
169- - uses : actions/checkout@v4
170+ - name : Checkout
171+ uses : actions/checkout@v4
170172 with :
171- submodules : true
172-
173- - name : Download MaaFramework
174- uses : robinraju/release-downloader@v1
175- with :
176- repository : MaaXYZ/MaaFramework
177- fileName : " MAA-android-${{ matrix.arch }}*"
178- latest : true
179- out-file-path : " deps"
180- extract : true
181-
182- - name : Install
183- shell : bash
184- run : |
185- python ./install.py ${{ needs.meta.outputs.tag }}
173+ fetch-depth : 0
186174
187- - uses : actions/upload-artifact@v4
175+ - name : Generate a changelog
176+ uses : orhun/git-cliff-action@v4
177+ id : git-cliff
188178 with :
189- name : MaaJR-android-${{ matrix.arch }}
190- path : " install"
179+ config : .github/cliff.toml
180+ args : -vv --latest --strip header
181+ env :
182+ OUTPUT : CHANGES.md
183+ GITHUB_REPO : ${{ github.repository }}
191184
192185 release :
193186 if : ${{ needs.meta.outputs.is_release == 'true' }}
194- needs : [meta, windows, ubuntu, macos, android ]
187+ needs : [meta, windows, unix, changelog ]
195188 runs-on : ubuntu-latest
196189 steps :
197190 - uses : actions/download-artifact@v4
198191 with :
199192 path : assets
200193
201- - run : |
194+ - name : Check assets directory
195+ run : |
196+ ls -la assets
197+ if [ -z "$(ls -A assets)" ]; then
198+ echo "assets directory is empty"
199+ exit 1
200+ fi
201+
202+ - name : Compress and generate checksums
203+ run : |
202204 cd assets
205+ echo "Generating checksums for all zip files..."
206+ checksum_file="checksums.sha256"
207+ touch "$checksum_file"
208+
203209 for f in *; do
204- (cd $f && zip -r ../$f-${{ needs.meta.outputs.tag }}.zip .)
210+ if [ -d "$f" ]; then
211+ echo "Processing directory: $f"
212+ zip_file="$f-${{ needs.meta.outputs.tag }}.zip"
213+ (cd "$f" && zip -r "../$zip_file" .)
214+ if [ $? -eq 0 ]; then
215+ echo "ZIP file created: ../$zip_file"
216+ echo "Processing directory: $f"
217+ sha256sum "$zip_file" >> "$checksum_file"
218+ echo "" >> "$checksum_file"
219+ else
220+ echo "Failed to create ZIP file: ../$zip_file"
221+ exit 1
222+ fi
223+ else
224+ echo "Skipping non-directory: $f"
225+ fi
205226 done
227+
206228 - uses : softprops/action-gh-release@v2
207229 with :
208230 files : assets/*
209231 tag_name : ${{ needs.meta.outputs.tag }}
232+ body : ${{ needs.changelog.outputs.release_body }}
233+ draft : false
234+ prerelease : ${{ needs.meta.outputs.is_prerelease == 'true' }}
210235
211236 - name : Trigger MirrorChyanUploading
212237 run : |
0 commit comments