Skip to content

Commit fd62938

Browse files
committed
fix:完全重构直接包含对应最新二进制文件
1 parent 7e58d9a commit fd62938

23 files changed

+1213
-1135
lines changed

.github/workflows/build.yml

Lines changed: 121 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
IS_RELEASE="true"
2929
else
3030
APP_VERSION="$BASE_VERSION"
31-
VERSION=v${BASE_VERSION}-$(date +%Y%m%d)-$(git rev-parse --short HEAD)
31+
VERSION=v${BASE_VERSION}
3232
IS_RELEASE="false"
3333
fi
3434
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
@@ -90,6 +90,45 @@ jobs:
9090
- name: Verify dependencies
9191
run: go mod verify
9292

93+
- name: Download ECS binaries for embed
94+
run: |
95+
REPO="oneclickvirt/ecs"
96+
BINARIES_DIR="binaries"
97+
98+
mkdir -p "$BINARIES_DIR"
99+
100+
# 获取最新版本
101+
echo "获取最新版本信息..."
102+
ECS_VERSION=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
103+
104+
if [ -z "$ECS_VERSION" ]; then
105+
echo "错误: 无法获取最新版本"
106+
exit 1
107+
fi
108+
109+
echo "ECS 版本: $ECS_VERSION"
110+
111+
# 下载 Linux ARM64(用于 Android ARM64)
112+
echo "下载 Linux ARM64..."
113+
curl -L -f -o "/tmp/goecs_linux_arm64.zip" \
114+
"https://github.com/${REPO}/releases/download/${ECS_VERSION}/goecs_linux_arm64.zip"
115+
unzip -q -o "/tmp/goecs_linux_arm64.zip" -d /tmp/
116+
mv /tmp/goecs "${BINARIES_DIR}/goecs-linux-arm64"
117+
chmod +x "${BINARIES_DIR}/goecs-linux-arm64"
118+
119+
# 下载 Linux AMD64(用于 Android x86_64)
120+
echo "下载 Linux AMD64..."
121+
curl -L -f -o "/tmp/goecs_linux_amd64.zip" \
122+
"https://github.com/${REPO}/releases/download/${ECS_VERSION}/goecs_linux_amd64.zip"
123+
unzip -q -o "/tmp/goecs_linux_amd64.zip" -d /tmp/
124+
mv /tmp/goecs "${BINARIES_DIR}/goecs-linux-amd64"
125+
chmod +x "${BINARIES_DIR}/goecs-linux-amd64"
126+
127+
echo ""
128+
echo "二进制文件列表:"
129+
ls -lh "${BINARIES_DIR}/"
130+
echo ""
131+
93132
- name: Update FyneApp.toml version
94133
run: |
95134
sed -i "s/Version = .*/Version = \"${{ needs.prepare.outputs.version }}\"/" FyneApp.toml
@@ -103,7 +142,7 @@ jobs:
103142
fyne package --os android --app-id com.oneclickvirt.goecs --app-version "${{ needs.prepare.outputs.app_version }}"
104143
if [ -f *.apk ]; then
105144
mkdir -p .build
106-
mv *.apk .build/goecs-android-arm64-${{ needs.prepare.outputs.version }}.apk
145+
mv *.apk .build/goecs-gui-android-arm64-${{ needs.prepare.outputs.version }}.apk
107146
echo "ARM64 APK 构建成功"
108147
else
109148
echo "ARM64 APK 构建失败"
@@ -117,7 +156,7 @@ jobs:
117156
run: |
118157
fyne package --os android/amd64 --app-id com.oneclickvirt.goecs --app-version "${{ needs.prepare.outputs.app_version }}"
119158
if [ -f *.apk ]; then
120-
mv *.apk .build/goecs-android-x86_64-${{ needs.prepare.outputs.version }}.apk
159+
mv *.apk .build/goecs-gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk
121160
echo "x86_64 APK 构建成功"
122161
else
123162
echo "x86_64 APK 构建失败"
@@ -129,18 +168,46 @@ jobs:
129168
ls -lh .build/
130169
du -sh .build/*.apk
131170
171+
- name: Get release
172+
id: get_release
173+
shell: bash
174+
run: |
175+
LATEST_RELEASE=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')
176+
if [ -z "$LATEST_RELEASE" ] || [ "$LATEST_RELEASE" == "null" ]; then
177+
exit 1
178+
else
179+
RELEASE_TAG="$LATEST_RELEASE"
180+
echo "Found existing release: $RELEASE_TAG"
181+
fi
182+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
183+
env:
184+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
186+
- name: Upload to release
187+
shell: bash
188+
run: |
189+
cd .build
190+
for file in *; do
191+
if [ -f "$file" ]; then
192+
echo "Uploading $file to release ${{ steps.get_release.outputs.RELEASE_TAG }}"
193+
gh release upload "${{ steps.get_release.outputs.RELEASE_TAG }}" "$file" --clobber
194+
fi
195+
done
196+
env:
197+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198+
132199
- name: Upload ARM64 APK
133200
uses: actions/upload-artifact@v4
134201
with:
135-
name: goecs-android-arm64-${{ needs.prepare.outputs.version }}
136-
path: .build/goecs-android-arm64-${{ needs.prepare.outputs.version }}.apk
202+
name: goecs-gui-android-arm64-${{ needs.prepare.outputs.version }}
203+
path: .build/goecs-gui-android-arm64-${{ needs.prepare.outputs.version }}.apk
137204
retention-days: 90
138205

139206
- name: Upload x86_64 APK
140207
uses: actions/upload-artifact@v4
141208
with:
142-
name: goecs-android-x86_64-${{ needs.prepare.outputs.version }}
143-
path: .build/goecs-android-x86_64-${{ needs.prepare.outputs.version }}.apk
209+
name: goecs-gui-android-x86_64-${{ needs.prepare.outputs.version }}
210+
path: .build/goecs-gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk
144211
retention-days: 90
145212

146213
build-desktop:
@@ -194,6 +261,51 @@ jobs:
194261
- name: Verify dependencies
195262
run: go mod verify
196263

264+
- name: Download ECS binaries for embed
265+
shell: bash
266+
run: |
267+
REPO="oneclickvirt/ecs"
268+
BINARIES_DIR="binaries"
269+
TARGET_OS="${{ matrix.platform }}"
270+
TARGET_ARCH="${{ matrix.arch }}"
271+
272+
mkdir -p "$BINARIES_DIR"
273+
274+
echo "获取最新版本信息..."
275+
ECS_VERSION=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
276+
277+
if [ -z "$ECS_VERSION" ]; then
278+
echo "错误: 无法获取最新版本"
279+
exit 1
280+
fi
281+
282+
echo "ECS 版本: $ECS_VERSION"
283+
echo "目标平台: $TARGET_OS/$TARGET_ARCH"
284+
285+
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${ECS_VERSION}/goecs_${TARGET_OS}_${TARGET_ARCH}.zip"
286+
OUTPUT_FILE="${BINARIES_DIR}/goecs-${TARGET_OS}-${TARGET_ARCH}"
287+
288+
echo "下载 ${TARGET_OS}/${TARGET_ARCH}..."
289+
echo "URL: $DOWNLOAD_URL"
290+
291+
curl -L -f -o "/tmp/goecs.zip" "$DOWNLOAD_URL"
292+
unzip -q -o "/tmp/goecs.zip" -d /tmp/
293+
294+
if [ -f "/tmp/goecs.exe" ]; then
295+
mv /tmp/goecs.exe "$OUTPUT_FILE"
296+
elif [ -f "/tmp/goecs" ]; then
297+
mv /tmp/goecs "$OUTPUT_FILE"
298+
chmod +x "$OUTPUT_FILE"
299+
else
300+
echo "错误: 找不到解压后的二进制文件"
301+
exit 1
302+
fi
303+
304+
echo ""
305+
echo "二进制文件列表:"
306+
ls -lh "${BINARIES_DIR}/"
307+
echo ""
308+
197309
- name: Update FyneApp.toml version
198310
shell: bash
199311
run: |
@@ -219,7 +331,7 @@ jobs:
219331
220332
if [ -d goecs.app ]; then
221333
mkdir -p .build
222-
TARFILE="goecs-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.gz"
334+
TARFILE="goecs-gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.gz"
223335
echo "Creating tar file: $TARFILE"
224336
tar -czf "$TARFILE" goecs.app
225337
mv "$TARFILE" .build/
@@ -236,7 +348,7 @@ jobs:
236348
if [ "${{ matrix.platform }}" == "windows" ]; then
237349
if [ -f goecs.exe ]; then
238350
mkdir -p .build
239-
mv goecs.exe .build/goecs-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.exe
351+
mv goecs.exe .build/goecs-gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.exe
240352
echo "✓ Windows exe 构建成功"
241353
else
242354
echo "✗ Windows exe 构建失败"

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ fyne-cross/
2020

2121
# Build binaries
2222
goecs-android
23+
goecs-desktop
24+
test-build
25+
26+
# Embedded binaries (downloaded during build)
27+
binaries/goecs-*
28+
binaries/*.zip

binaries/.gitkeep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Placeholder for embedded binaries
2+
# These files will be downloaded by build.sh before compilation

0 commit comments

Comments
 (0)