@@ -3,17 +3,17 @@ name: Build All UI APP
33on :
44 push :
55 branches :
6- - ' gui '
6+ - ' main '
77 workflow_dispatch :
88
99jobs :
1010 prepare :
11- name : Prepare Version
11+ name : Prepare Version and Create Release
1212 runs-on : ubuntu-latest
1313 outputs :
1414 version : ${{ steps.version.outputs.VERSION }}
1515 app_version : ${{ steps.version.outputs.APP_VERSION }}
16- is_release : ${{ steps.version.outputs.IS_RELEASE }}
16+ release_tag : ${{ steps.version.outputs.RELEASE_TAG }}
1717 steps :
1818 - name : Checkout code
1919 uses : actions/checkout@v4
@@ -22,20 +22,39 @@ jobs:
2222 id : version
2323 run : |
2424 BASE_VERSION=$(cat VERSION)
25- if [[ "${{ github.ref }}" == refs/tags/* ]]; then
26- VERSION=${GITHUB_REF#refs/tags/}
27- APP_VERSION=${VERSION#v}
28- IS_RELEASE="true"
29- else
30- APP_VERSION="$BASE_VERSION"
31- VERSION=v${BASE_VERSION}
32- IS_RELEASE="false"
25+ # 使用当前日期时间生成tag (格式: v20260202-HHMMSS)
26+ CURRENT_DATE=$(TZ='Asia/Shanghai' date +'%Y%m%d-%H%M%S')
27+ RELEASE_TAG="v${CURRENT_DATE}"
28+ APP_VERSION="${BASE_VERSION}"
29+
30+ echo "VERSION=${RELEASE_TAG}" >> $GITHUB_OUTPUT
31+ echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_OUTPUT
32+ echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_OUTPUT
33+ echo "Building version: ${RELEASE_TAG}"
34+ echo "App version: ${APP_VERSION}"
35+
36+ - name : Create Release
37+ env :
38+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
39+ run : |
40+ RELEASE_TAG="${{ steps.version.outputs.RELEASE_TAG }}"
41+
42+ # 检查release是否已存在
43+ if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
44+ echo "Release $RELEASE_TAG already exists, deleting it..."
45+ gh release delete "$RELEASE_TAG" -y || true
46+ git push --delete origin "$RELEASE_TAG" || true
3347 fi
34- echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
35- echo "APP_VERSION=$APP_VERSION" >> $GITHUB_OUTPUT
36- echo "IS_RELEASE=$IS_RELEASE" >> $GITHUB_OUTPUT
37- echo "Building version: $VERSION"
38- echo "App version: $APP_VERSION"
48+
49+ # 创建新的release
50+ echo "Creating release $RELEASE_TAG..."
51+ gh release create "$RELEASE_TAG" \
52+ --title "Release $RELEASE_TAG" \
53+ --notes "Automated build for $RELEASE_TAG" \
54+ --draft=false \
55+ --prerelease=false
56+
57+ echo "Release $RELEASE_TAG created successfully"
3958
4059 build-android :
4160 name : Build Android APK
@@ -80,14 +99,13 @@ jobs:
8099 - name : Configure Git for Private Modules
81100 run : |
82101 git config --global url."https://${{ secrets.GHT }}@github.com/".insteadOf "https://github.com/"
83- git config --global url."git@github.com:".insteadOf "https://github.com/"
84102 env :
85103 GITHUB_TOKEN : ${{ secrets.GHT }}
86104
87105 - name : Download dependencies
88106 run : go mod download
89107 env :
90- GOPRIVATE : github.com/oneclickvirt/security
108+ GOPRIVATE : github.com/oneclickvirt/security,github.com/oneclickvirt/privatespeedtest
91109
92110 - name : Verify dependencies
93111 run : go mod verify
@@ -100,14 +118,14 @@ jobs:
100118 - name : Build Android APK (arm64)
101119 env :
102120 ANDROID_NDK_HOME : ${{ env.ANDROID_NDK_HOME }}
103- GOPRIVATE : github.com/oneclickvirt/security
121+ GOPRIVATE : github.com/oneclickvirt/security,github.com/oneclickvirt/privatespeedtest
104122 FYNE_BUILD_FLAGS : " -trimpath -ldflags '-s -w'"
105123 run : |
106- fyne package --os android --app-id com.oneclickvirt.goecs --app-version "${{ needs.prepare.outputs.app_version }}" --release
124+ fyne package --os android --app-id com.oneclickvirt.ecsgui --app-version "${{ needs.prepare.outputs.app_version }}" --release
107125 if [ -f *.apk ]; then
108- mv *.apk goecs -gui-android-arm64-${{ needs.prepare.outputs.version }}.apk
126+ mv *.apk ecs -gui-android-arm64-${{ needs.prepare.outputs.version }}.apk
109127 echo "ARM64 APK 构建成功"
110- ls -lh goecs -gui-android-arm64-${{ needs.prepare.outputs.version }}.apk
128+ ls -lh ecs -gui-android-arm64-${{ needs.prepare.outputs.version }}.apk
111129 else
112130 echo "ARM64 APK 构建失败"
113131 exit 1
@@ -116,16 +134,16 @@ jobs:
116134 - name : Build Android APK (x86_64)
117135 env :
118136 ANDROID_NDK_HOME : ${{ env.ANDROID_NDK_HOME }}
119- GOPRIVATE : github.com/oneclickvirt/security
137+ GOPRIVATE : github.com/oneclickvirt/security,github.com/oneclickvirt/privatespeedtest
120138 FYNE_BUILD_FLAGS : " -trimpath -ldflags '-s -w'"
121139 run : |
122- fyne package --os android/amd64 --app-id com.oneclickvirt.goecs --app-version "${{ needs.prepare.outputs.app_version }}" --release
140+ fyne package --os android/amd64 --app-id com.oneclickvirt.ecsgui --app-version "${{ needs.prepare.outputs.app_version }}" --release
123141 # 查找新生成的 APK(排除已重命名的 arm64 版本)
124- NEW_APK=$(find . -maxdepth 1 -name "*.apk" -not -name "goecs -gui-android-*" -type f | head -n 1)
142+ NEW_APK=$(find . -maxdepth 1 -name "*.apk" -not -name "ecs -gui-android-*" -type f | head -n 1)
125143 if [ -n "$NEW_APK" ]; then
126- mv "$NEW_APK" goecs -gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk
144+ mv "$NEW_APK" ecs -gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk
127145 echo "x86_64 APK 构建成功"
128- ls -lh goecs -gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk
146+ ls -lh ecs -gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk
129147 else
130148 echo "x86_64 APK 构建失败"
131149 exit 1
@@ -197,7 +215,7 @@ jobs:
197215 echo "使用 apksigner: $APKSIGNER"
198216
199217 # 对所有 APK 文件进行签名
200- for apk in goecs -gui-android-*.apk; do
218+ for apk in ecs -gui-android-*.apk; do
201219 if [ -f "$apk" ]; then
202220 echo "正在签名: $apk"
203221 SIGNED_APK="${apk%.apk}_signed.apk"
@@ -230,31 +248,17 @@ jobs:
230248
231249 - name : List build artifacts
232250 run : |
233- ls -lh goecs-gui-android-*.apk
234- du -sh goecs-gui-android-*.apk
235-
236- - name : Get release
237- id : get_release
238- shell : bash
239- run : |
240- LATEST_RELEASE=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')
241- if [ -z "$LATEST_RELEASE" ] || [ "$LATEST_RELEASE" == "null" ]; then
242- exit 1
243- else
244- RELEASE_TAG="$LATEST_RELEASE"
245- echo "Found existing release: $RELEASE_TAG"
246- fi
247- echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
248- env :
249- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
251+ ls -lh ecs-gui-android-*.apk
252+ du -sh ecs-gui-android-*.apk
250253
251254 - name : Upload to release
252255 shell : bash
253256 run : |
254- for file in goecs-gui-android-*.apk; do
257+ RELEASE_TAG="${{ needs.prepare.outputs.release_tag }}"
258+ for file in ecs-gui-android-*.apk; do
255259 if [ -f "$file" ]; then
256- echo "Uploading $file to release ${{ steps.get_release.outputs. RELEASE_TAG }} "
257- gh release upload "${{ steps.get_release.outputs. RELEASE_TAG }} " "$file" --clobber
260+ echo "Uploading $file to release $RELEASE_TAG"
261+ gh release upload "$RELEASE_TAG" "$file" --clobber
258262 fi
259263 done
260264 env :
@@ -263,15 +267,15 @@ jobs:
263267 - name : Upload ARM64 APK
264268 uses : actions/upload-artifact@v4
265269 with :
266- name : goecs -gui-android-arm64-${{ needs.prepare.outputs.version }}
267- path : goecs -gui-android-arm64-${{ needs.prepare.outputs.version }}.apk
270+ name : ecs -gui-android-arm64-${{ needs.prepare.outputs.version }}
271+ path : ecs -gui-android-arm64-${{ needs.prepare.outputs.version }}.apk
268272 retention-days : 90
269273
270274 - name : Upload x86_64 APK
271275 uses : actions/upload-artifact@v4
272276 with :
273- name : goecs -gui-android-x86_64-${{ needs.prepare.outputs.version }}
274- path : goecs -gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk
277+ name : ecs -gui-android-x86_64-${{ needs.prepare.outputs.version }}
278+ path : ecs -gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk
275279 retention-days : 90
276280
277281 build-desktop :
@@ -320,7 +324,7 @@ jobs:
320324 - name : Download dependencies
321325 run : go mod download
322326 env :
323- GOPRIVATE : github.com/oneclickvirt/security
327+ GOPRIVATE : github.com/oneclickvirt/security,github.com/oneclickvirt/privatespeedtest
324328
325329 - name : Verify dependencies
326330 run : go mod verify
@@ -347,22 +351,22 @@ jobs:
347351
348352 - name : Build for ${{ matrix.name }}
349353 env :
350- GOPRIVATE : github.com/oneclickvirt/security
354+ GOPRIVATE : github.com/oneclickvirt/security,github.com/oneclickvirt/privatespeedtest
351355 FYNE_BUILD_FLAGS : " -trimpath -ldflags '-s -w -checklinkname=0'"
352356 shell : bash
353357 run : |
354358 # macOS 需要特殊处理:先编译再打包
355359 if [ "${{ matrix.platform }}" == "darwin" ]; then
356360 echo "Building macOS binary with ldflags..."
357- go build -trimpath -ldflags "-checklinkname=0 -s -w" -o goecs -bin .
361+ go build -trimpath -ldflags "-checklinkname=0 -s -w" -o ecs-gui -bin .
358362
359363 echo "Packaging macOS app with fyne..."
360- fyne package -os darwin -name goecs --exe goecs -bin --app-version "${{ needs.prepare.outputs.app_version }}" --release
364+ fyne package -os darwin -name ecs-gui --exe ecs-gui -bin --app-version "${{ needs.prepare.outputs.app_version }}" --release
361365
362- if [ -d goecs .app ]; then
363- TARFILE="goecs -gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.gz"
366+ if [ -d ecs-gui .app ]; then
367+ TARFILE="ecs -gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.gz"
364368 echo "Creating tar file: $TARFILE"
365- tar -czf "$TARFILE" goecs .app
369+ tar -czf "$TARFILE" ecs-gui .app
366370 echo "✓ macOS app 构建成功"
367371 else
368372 echo "✗ macOS app 构建失败"
@@ -371,11 +375,11 @@ jobs:
371375 else
372376 # Windows 直接使用 fyne package
373377 echo "Building ${{ matrix.platform }} with fyne package..."
374- fyne package -os ${{ matrix.platform }} -name goecs --app-version "${{ needs.prepare.outputs.app_version }}" --release
378+ fyne package -os ${{ matrix.platform }} -name ecs-gui --app-version "${{ needs.prepare.outputs.app_version }}" --release
375379
376380 if [ "${{ matrix.platform }}" == "windows" ]; then
377- if [ -f goecs .exe ]; then
378- mv goecs .exe goecs -gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.exe
381+ if [ -f ecs-gui .exe ]; then
382+ mv ecs-gui .exe ecs -gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.exe
379383 echo "✓ Windows exe 构建成功"
380384 else
381385 echo "✗ Windows exe 构建失败"
@@ -393,7 +397,7 @@ jobs:
393397 exit 0
394398 fi
395399
396- for file in goecs -gui-${{ matrix.name }}-*; do
400+ for file in ecs -gui-${{ matrix.name }}-*; do
397401 if [ -f "$file" ]; then
398402 echo "压缩前大小: $(du -h "$file")"
399403
@@ -403,8 +407,8 @@ jobs:
403407 tar -xzf "$file"
404408
405409 # 查找并压缩 macOS 可执行文件
406- if [ -d goecs .app/Contents/MacOS ]; then
407- for binary in goecs .app/Contents/MacOS/*; do
410+ if [ -d ecs-gui .app/Contents/MacOS ]; then
411+ for binary in ecs-gui .app/Contents/MacOS/*; do
408412 if [ -f "$binary" ] && [ -x "$binary" ]; then
409413 echo "正在压缩 macOS 二进制: $binary"
410414 upx --best --lzma "$binary" || echo "警告: $binary 压缩失败"
@@ -414,8 +418,8 @@ jobs:
414418
415419 # 重新打包
416420 rm "$file"
417- tar -czf "$file" goecs .app
418- rm -rf goecs .app
421+ tar -czf "$file" ecs-gui .app
422+ rm -rf ecs-gui .app
419423 echo "压缩后大小: $(du -h "$file")"
420424 fi
421425 fi
@@ -424,31 +428,17 @@ jobs:
424428 - name : List build artifacts
425429 shell : bash
426430 run : |
427- ls -lh goecs-gui-${{ matrix.name }}-*
428- du -sh goecs-gui-${{ matrix.name }}-*
429-
430- - name : Get release
431- id : get_release
432- shell : bash
433- run : |
434- LATEST_RELEASE=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')
435- if [ -z "$LATEST_RELEASE" ] || [ "$LATEST_RELEASE" == "null" ]; then
436- exit 1
437- else
438- RELEASE_TAG="$LATEST_RELEASE"
439- echo "Found existing release: $RELEASE_TAG"
440- fi
441- echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
442- env :
443- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
431+ ls -lh ecs-gui-${{ matrix.name }}-*
432+ du -sh ecs-gui-${{ matrix.name }}-*
444433
445434 - name : Upload to release
446435 shell : bash
447436 run : |
448- for file in goecs-gui-${{ matrix.name }}-*; do
437+ RELEASE_TAG="${{ needs.prepare.outputs.release_tag }}"
438+ for file in ecs-gui-${{ matrix.name }}-*; do
449439 if [ -f "$file" ]; then
450- echo "Uploading $file to release ${{ steps.get_release.outputs. RELEASE_TAG }} "
451- gh release upload "${{ steps.get_release.outputs. RELEASE_TAG }} " "$file" --clobber
440+ echo "Uploading $file to release $RELEASE_TAG"
441+ gh release upload "$RELEASE_TAG" "$file" --clobber
452442 fi
453443 done
454444 env :
0 commit comments