Files
MyGoNavi/.github/workflows/release.yml
杨国锋 3007d7c08e 👷 ci(release): 增强构建脚本的兼容性与调试信息
- 引入 find 命令自动定位 Wails 构建产物
- 增加 ls -F 输出以辅助排查文件路径问题
- 确保 artifact 压缩与上传步骤的路径准确性
2026-02-02 12:22:31 +08:00

97 lines
2.5 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-and-release:
name: Build ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
platform: darwin/amd64
artifact_name: GoNavi-mac-amd64
- os: macos-latest
platform: darwin/arm64
artifact_name: GoNavi-mac-arm64
- os: windows-latest
platform: windows/amd64
artifact_name: GoNavi-windows-amd64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
check-latest: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Build
shell: bash
run: |
wails build -platform ${{ matrix.platform }} -clean -o ${{ matrix.artifact_name }}
- name: Package (macOS)
if: runner.os == 'macOS'
run: |
cd build/bin
echo "📂 Listing build/bin contents:"
ls -F
# Find the .app bundle (safest way)
APP_NAME=$(find . -maxdepth 1 -name "*.app" | head -n 1)
if [ -z "$APP_NAME" ]; then
echo "❌ No .app found!"
exit 1
fi
echo "📦 Zipping $APP_NAME..."
zip -r "../../${{ matrix.artifact_name }}.zip" "$APP_NAME"
- name: Package (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
cd build/bin
echo "📂 Listing build/bin contents:"
ls -F
# Find the .exe (safest way)
EXE_NAME=$(find . -maxdepth 1 -name "*.exe" | head -n 1)
if [ -z "$EXE_NAME" ]; then
echo "❌ No .exe found!"
exit 1
fi
echo "📦 Moving $EXE_NAME..."
mv "$EXE_NAME" "../../${{ matrix.artifact_name }}.exe"
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ matrix.artifact_name }}.zip
${{ matrix.artifact_name }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}