mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-07 05:42:43 +08:00
🐛 fix(workflows): 修复artifact_name 冲突
This commit is contained in:
76
.github/workflows/release.yml
vendored
76
.github/workflows/release.yml
vendored
@@ -36,21 +36,9 @@ jobs:
|
||||
- os: ubuntu-22.04
|
||||
platform: linux/amd64
|
||||
artifact_name: GoNavi-linux-amd64
|
||||
asset_ext: .tar.gz
|
||||
- os: ubuntu-22.04
|
||||
platform: linux/arm64
|
||||
artifact_name: GoNavi-linux-arm64
|
||||
asset_ext: .tar.gz
|
||||
- os: ubuntu-22.04
|
||||
platform: linux/amd64
|
||||
artifact_name: GoNavi-linux-amd64
|
||||
asset_ext: .AppImage
|
||||
build_appimage: true
|
||||
- os: ubuntu-22.04
|
||||
platform: linux/arm64
|
||||
artifact_name: GoNavi-linux-arm64
|
||||
asset_ext: .AppImage
|
||||
build_appimage: true
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -82,18 +70,16 @@ jobs:
|
||||
sudo apt-get install -y libgtk-3-dev:arm64 libwebkit2gtk-4.0-dev:arm64 || true
|
||||
fi
|
||||
|
||||
# AppImage tools
|
||||
if [ "${{ matrix.build_appimage }}" = "true" ]; then
|
||||
sudo apt-get install -y libfuse2
|
||||
if [ "${{ matrix.platform }}" = "linux/arm64" ]; then
|
||||
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-aarch64.AppImage -O /tmp/linuxdeploy
|
||||
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/releases/download/continuous/linuxdeploy-plugin-gtk-aarch64.AppImage -O /tmp/linuxdeploy-plugin-gtk
|
||||
else
|
||||
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O /tmp/linuxdeploy
|
||||
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/releases/download/continuous/linuxdeploy-plugin-gtk-x86_64.AppImage -O /tmp/linuxdeploy-plugin-gtk
|
||||
fi
|
||||
chmod +x /tmp/linuxdeploy /tmp/linuxdeploy-plugin-gtk
|
||||
# AppImage tools (always install for Linux)
|
||||
sudo apt-get install -y libfuse2
|
||||
if [ "${{ matrix.platform }}" = "linux/arm64" ]; then
|
||||
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-aarch64.AppImage -O /tmp/linuxdeploy
|
||||
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/releases/download/continuous/linuxdeploy-plugin-gtk-aarch64.AppImage -O /tmp/linuxdeploy-plugin-gtk
|
||||
else
|
||||
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O /tmp/linuxdeploy
|
||||
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/releases/download/continuous/linuxdeploy-plugin-gtk-x86_64.AppImage -O /tmp/linuxdeploy-plugin-gtk
|
||||
fi
|
||||
chmod +x /tmp/linuxdeploy /tmp/linuxdeploy-plugin-gtk
|
||||
|
||||
- name: Install Wails
|
||||
run: go install -v github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
@@ -165,26 +151,9 @@ jobs:
|
||||
echo "📦 正在移动 $FINAL_EXE 到根目录..."
|
||||
mv "$FINAL_EXE" "../../$FINAL_EXE"
|
||||
|
||||
# Linux Packaging
|
||||
- name: Package Linux tar.gz
|
||||
if: contains(matrix.platform, 'linux') && matrix.build_appimage != true
|
||||
run: |
|
||||
cd build/bin
|
||||
TARGET="${{ matrix.artifact_name }}"
|
||||
|
||||
if [ -f "$TARGET" ]; then
|
||||
chmod +x "$TARGET"
|
||||
echo "📦 正在打包 $TARGET.tar.gz..."
|
||||
tar -czvf "$TARGET.tar.gz" "$TARGET"
|
||||
mv "$TARGET.tar.gz" ../../
|
||||
else
|
||||
echo "❌ 未找到构建产物 '$TARGET'!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Linux AppImage Packaging
|
||||
- name: Package Linux AppImage
|
||||
if: matrix.build_appimage == true
|
||||
# Linux Packaging (tar.gz and AppImage)
|
||||
- name: Package Linux
|
||||
if: contains(matrix.platform, 'linux')
|
||||
run: |
|
||||
cd build/bin
|
||||
TARGET="${{ matrix.artifact_name }}"
|
||||
@@ -196,6 +165,14 @@ jobs:
|
||||
|
||||
chmod +x "$TARGET"
|
||||
|
||||
# 1. Create tar.gz
|
||||
echo "📦 正在打包 $TARGET.tar.gz..."
|
||||
tar -czvf "$TARGET.tar.gz" "$TARGET"
|
||||
mv "$TARGET.tar.gz" ../../
|
||||
|
||||
# 2. Create AppImage
|
||||
echo "📦 正在生成 AppImage..."
|
||||
|
||||
# Create AppDir structure
|
||||
mkdir -p AppDir/usr/bin
|
||||
mkdir -p AppDir/usr/share/applications
|
||||
@@ -229,20 +206,25 @@ jobs:
|
||||
fi
|
||||
|
||||
# Build AppImage
|
||||
echo "📦 正在生成 AppImage..."
|
||||
export DEPLOY_GTK_VERSION=3
|
||||
/tmp/linuxdeploy --appdir AppDir --plugin gtk --output appimage
|
||||
|
||||
# Rename output
|
||||
mv GoNavi*.AppImage "$TARGET.AppImage"
|
||||
mv "$TARGET.AppImage" ../../
|
||||
mv GoNavi*.AppImage "$TARGET.AppImage" 2>/dev/null || echo "⚠️ AppImage 生成失败,跳过"
|
||||
if [ -f "$TARGET.AppImage" ]; then
|
||||
mv "$TARGET.AppImage" ../../
|
||||
fi
|
||||
|
||||
# Upload to Actions Artifacts (Temporary Storage)
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-artifacts-${{ strategy.job-index }} # Unique name per job
|
||||
path: GoNavi-*${{ matrix.asset_ext }}
|
||||
path: |
|
||||
GoNavi-*.dmg
|
||||
GoNavi-*.exe
|
||||
GoNavi-*.tar.gz
|
||||
GoNavi-*.AppImage
|
||||
retention-days: 1
|
||||
|
||||
# Phase 2: Collect all artifacts and Publish Release (Single Job)
|
||||
|
||||
Reference in New Issue
Block a user