-
Notifications
You must be signed in to change notification settings - Fork 1
339 lines (290 loc) · 10.7 KB
/
Copy pathrelease.yml
File metadata and controls
339 lines (290 loc) · 10.7 KB
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
name: Release Multi-Platform AOT
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Update Version Info
shell: pwsh
run: pwsh -File ./scripts/set-version.ps1
- name: Build and Publish Windows x64 AOT
run: dotnet publish ProxyChecker.csproj -r win-x64 -c Release --self-contained true -p:PublishAot=true -o ./publish/win-x64
- name: Build and Publish Windows x86 AOT
run: dotnet publish ProxyChecker.csproj -r win-x86 -c Release --self-contained true -p:PublishAot=true -o ./publish/win-x86
- name: Build and Publish Windows ARM64 AOT
run: dotnet publish ProxyChecker.csproj -r win-arm64 -c Release --self-contained true -p:PublishAot=true -o ./publish/win-arm64
- name: Install Velopack CLI
run: dotnet tool install -g vpk
- name: Get Version
id: get_version
shell: pwsh
run: |
$version = "${{ github.ref_name }}".TrimStart('v')
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
- name: Pack Release
run: |
vpk pack -u ProxyChecker -v ${{ steps.get_version.outputs.VERSION }} -p ./publish/win-x64 -e ProxyChecker.exe
- name: Upload Windows Artifacts
uses: actions/upload-artifact@v4
with:
name: windows-releases
path: |
Releases/*
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Update Version Info
run: pwsh -File ./scripts/set-version.ps1
- name: Build and Publish macOS x64 AOT
run: dotnet publish ProxyChecker.csproj -r osx-x64 -c Release --self-contained true -p:PublishAot=true -o ./publish/osx-x64
- name: Build and Publish macOS ARM64 AOT
run: dotnet publish ProxyChecker.csproj -r osx-arm64 -c Release --self-contained true -p:PublishAot=true -o ./publish/osx-arm64
- name: Install Velopack CLI
run: dotnet tool install -g vpk
- name: Get Version
id: get_version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Create .app Bundle (x64)
run: |
mkdir -p ./publish/osx-x64/ProxyChecker.app/Contents/MacOS
mkdir -p ./publish/osx-x64/ProxyChecker.app/Contents/Resources
cp ./publish/osx-x64/ProxyChecker ./publish/osx-x64/ProxyChecker.app/Contents/MacOS/
cp ./publish/osx-x64/*.dylib ./publish/osx-x64/ProxyChecker.app/Contents/MacOS/ 2>/dev/null || :
cat > ./publish/osx-x64/ProxyChecker.app/Contents/Info.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>ProxyChecker</string>
<key>CFBundleIdentifier</key>
<string>com.interface95.proxychecker</string>
<key>CFBundleName</key>
<string>ProxyChecker</string>
<key>CFBundleVersion</key>
<string>${{ steps.get_version.outputs.VERSION }}</string>
<key>CFBundleShortVersionString</key>
<string>${{ steps.get_version.outputs.VERSION }}</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
</dict>
</plist>
EOF
- name: Create .app Bundle (ARM64)
run: |
mkdir -p ./publish/osx-arm64/ProxyChecker.app/Contents/MacOS
mkdir -p ./publish/osx-arm64/ProxyChecker.app/Contents/Resources
cp ./publish/osx-arm64/ProxyChecker ./publish/osx-arm64/ProxyChecker.app/Contents/MacOS/
cp ./publish/osx-arm64/*.dylib ./publish/osx-arm64/ProxyChecker.app/Contents/MacOS/ 2>/dev/null || :
cat > ./publish/osx-arm64/ProxyChecker.app/Contents/Info.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>ProxyChecker</string>
<key>CFBundleIdentifier</key>
<string>com.interface95.proxychecker</string>
<key>CFBundleName</key>
<string>ProxyChecker</string>
<key>CFBundleVersion</key>
<string>${{ steps.get_version.outputs.VERSION }}</string>
<key>CFBundleShortVersionString</key>
<string>${{ steps.get_version.outputs.VERSION }}</string>
<key>LSMinimumSystemVersion</key>
<string>11.0</string>
</dict>
</plist>
EOF
- name: Pack Release (x64)
run: |
vpk pack -u ProxyChecker -v ${{ steps.get_version.outputs.VERSION }} -p ./publish/osx-x64/ProxyChecker.app -e ProxyChecker
mv Releases Releases-x64
- name: Pack Release (ARM64)
run: |
vpk pack -u ProxyChecker-arm64 -v ${{ steps.get_version.outputs.VERSION }} -p ./publish/osx-arm64/ProxyChecker.app -e ProxyChecker
mv Releases Releases-arm64
# Rename ARM64 metadata files to avoid conflict with x64
cd Releases-arm64
[ -f RELEASES-osx ] && mv RELEASES-osx RELEASES-osx-arm64
[ -f releases.osx.json ] && mv releases.osx.json releases-osx-arm64.json
[ -f assets.osx.json ] && mv assets.osx.json assets-osx-arm64.json
- name: Upload macOS Artifacts
uses: actions/upload-artifact@v4
with:
name: macos-releases
path: |
Releases-x64/*
Releases-arm64/*
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- name: x64
runtime: linux-x64
cross_compile: false
- name: arm64
runtime: linux-arm64
cross_compile: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Install cross-compilation tools and dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang zlib1g-dev dpkg-dev
if [ "${{ matrix.arch.cross_compile }}" = "true" ]; then
# Install ARM64 cross-compilation tools
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
# Create symlinks to ensure the correct tools are used
sudo ln -sf /usr/bin/aarch64-linux-gnu-objcopy /usr/local/bin/objcopy
sudo ln -sf /usr/bin/aarch64-linux-gnu-strip /usr/local/bin/strip
else
# For x64, install native tools
sudo apt-get install -y build-essential
fi
- name: Restore dependencies
run: dotnet restore
- name: Publish AOT Linux ${{ matrix.arch.name }}
run: |
if [ "${{ matrix.arch.cross_compile }}" = "true" ]; then
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
CROSS_COMPILE_FLAG="-p:CrossCompiling=true"
else
export CC=gcc
export CXX=g++
CROSS_COMPILE_FLAG=""
fi
# Verify tools are available
which objcopy
which strip
objcopy --version
dotnet publish ProxyChecker.csproj \
--configuration Release \
--runtime ${{ matrix.arch.runtime }} \
--self-contained true \
--output ./publish/${{ matrix.arch.name }} \
-p:PublishAot=true \
-p:StripSymbols=true \
-p:PublishTrimmed=true \
-p:TrimMode=link \
$CROSS_COMPILE_FLAG
- name: Create Archives
run: |
cd ./publish/${{ matrix.arch.name }}
tar -czf ../../ProxyChecker-linux-${{ matrix.arch.name }}.tar.gz .
- name: Upload Linux ${{ matrix.arch.name }} Artifacts
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.arch.name }}-releases
path: |
*.tar.gz
create-release:
needs: [build-windows, build-macos, build-linux]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
configuration: |
{
"categories": [
{
"title": "## 🚀 新功能",
"labels": ["feature", "feat"]
},
{
"title": "## 🐛 Bug 修复",
"labels": ["fix", "bug"]
},
{
"title": "## 🔧 其他改进",
"labels": []
}
],
"template": "#{{CHANGELOG}}\n\n---\n**Full Changelog**: #{{RELEASE_DIFF}}",
"pr_template": "- #{{TITLE}} (#{{NUMBER}})",
"empty_template": "本次更新包含以下提交:\n\n#{{UNCATEGORIZED}}",
"transformers": [],
"max_tags_to_fetch": 200,
"max_pull_requests": 200,
"max_back_track_time_days": 365,
"exclude_merge_branches": [],
"tag_resolver": {
"method": "semver"
},
"base_branches": ["main", "master"]
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Windows Artifacts
uses: actions/download-artifact@v4
with:
name: windows-releases
path: windows-releases
- name: Download macOS Artifacts
uses: actions/download-artifact@v4
with:
name: macos-releases
path: macos-releases
- name: Download Linux x64 Artifacts
uses: actions/download-artifact@v4
with:
name: linux-x64-releases
path: linux-x64-releases
- name: Download Linux ARM64 Artifacts
uses: actions/download-artifact@v4
with:
name: linux-arm64-releases
path: linux-arm64-releases
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog.outputs.changelog }}
files: |
windows-releases/*
macos-releases/**/*
linux-x64-releases/*
linux-arm64-releases/**/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}