Skip to content

chore(release): 更新预发布版本号 1.1.3-rc.202601310109 #118

chore(release): 更新预发布版本号 1.1.3-rc.202601310109

chore(release): 更新预发布版本号 1.1.3-rc.202601310109 #118

Workflow file for this run

name: Release
on:
push:
tags:
- '*.*.*'
permissions:
contents: write
jobs:
build_win:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Setup Python (for node-gyp)
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Ensure setuptools available
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Install dependencies
run: pnpm install --frozen-lockfile=false
- name: Prepare FFmpeg (Windows)
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path vendor/ffmpeg/win32-x64 | Out-Null
$url = 'https://github.com/BtbN/FFmpeg-Builds/releases/latest/download/ffmpeg-master-latest-win64-gpl.zip'
Invoke-WebRequest -Uri $url -OutFile ffmpeg.zip
Expand-Archive -Path ffmpeg.zip -DestinationPath ffmpeg_unzip -Force
$ff = (Get-ChildItem -Recurse -Filter ffmpeg.exe ffmpeg_unzip | Select-Object -First 1).FullName
Copy-Item -Path $ff -Destination vendor/ffmpeg/win32-x64/ffmpeg.exe -Force
Remove-Item ffmpeg.zip -Force
Remove-Item ffmpeg_unzip -Recurse -Force
- name: Prepare Chromaprint (Windows)
shell: pwsh
run: |
$chromaprintVersion = '1.5.1'
$tag = "v$chromaprintVersion"
$url = "https://github.com/acoustid/chromaprint/releases/download/$tag/chromaprint-fpcalc-$chromaprintVersion-windows-x86_64.zip"
New-Item -ItemType Directory -Force -Path vendor/chromaprint/win32-x64 | Out-Null
Invoke-WebRequest -Uri $url -OutFile fpcalc.zip
Expand-Archive -Path fpcalc.zip -DestinationPath fpcalc_unzip -Force
$fpcalc = Get-ChildItem -Recurse -Filter fpcalc.exe fpcalc_unzip | Select-Object -First 1
if (-not $fpcalc) {
throw "fpcalc.exe not found in downloaded archive."
}
Copy-Item -Path $fpcalc.FullName -Destination vendor/chromaprint/win32-x64/fpcalc.exe -Force
Remove-Item fpcalc.zip -Force
Remove-Item fpcalc_unzip -Recurse -Force
- name: Build Rust N-API (rust_package)
working-directory: rust_package
run: npx --yes @napi-rs/cli@2.18.4 build --platform --release --target x86_64-pc-windows-msvc
- name: Build (vite)
env:
CLOUD_SYNC_BASE_URL_PROD: ${{ secrets.CLOUD_SYNC_BASE_URL_PROD }}
CLOUD_SYNC_API_SECRET_KEY: ${{ secrets.CLOUD_SYNC_API_SECRET_KEY }}
run: pnpm build
- name: Package (electron-builder, no publish)
run: npx electron-builder --win --x64 --publish never
# 不再复制 rc.yml,严格遵循 GitHub provider 读取 latest.yml / latest-mac.yml
- name: Upload dist artifacts (Windows)
uses: actions/upload-artifact@v4
if: always()
with:
name: win-artifacts
path: |
dist/*.exe
dist/*.blockmap
dist/*.yml
build_mac:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Setup Python (for node-gyp)
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Ensure setuptools available
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin, x86_64-apple-darwin
- name: Ensure Rust targets
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
- name: Install dependencies
run: pnpm install --frozen-lockfile=false
- name: Prepare FFmpeg (macOS both arch)
run: |
set -euxo pipefail
mkdir -p vendor/ffmpeg/darwin-arm64 vendor/ffmpeg/darwin-x64 vendor/ffmpeg/darwin
echo "=== Host uname ==="
uname -a
sw_vers
# 使用 Homebrew 安装 arm64 版本 (native on arm64 runner)
echo "Installing arm64 ffmpeg via Homebrew"
brew update
brew install ffmpeg
ARM64_FFMPEG_PATH="$(brew --prefix)/bin/ffmpeg"
file "$ARM64_FFMPEG_PATH"
install -m 755 "$ARM64_FFMPEG_PATH" vendor/ffmpeg/darwin-arm64/ffmpeg
# 从多个源尝试下载 x64 版本
X64_DOWNLOADED=false
# 方案1: 尝试 ffbinaries.com
echo "Trying to download x64 ffmpeg from ffbinaries..."
if curl -L "https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v4.4.1/ffmpeg-4.4.1-osx-64.zip" -o ffmpeg-x64.zip && [ -f ffmpeg-x64.zip ]; then
unzip -q ffmpeg-x64.zip -d ffmpeg-x64-temp || true
if [ -f ffmpeg-x64-temp/ffmpeg ]; then
file ffmpeg-x64-temp/ffmpeg
if file ffmpeg-x64-temp/ffmpeg | grep -q "x86_64"; then
install -m 755 ffmpeg-x64-temp/ffmpeg vendor/ffmpeg/darwin-x64/ffmpeg
X64_DOWNLOADED=true
echo "✓ Successfully downloaded x64 ffmpeg from ffbinaries"
else
echo "ffbinaries artifact is not x86_64"
fi
else
echo "ffbinaries archive missing ffmpeg binary"
fi
rm -rf ffmpeg-x64-temp ffmpeg-x64.zip
fi
# 方案2: 如果方案1失败,尝试从 npm ffmpeg-static 提取
if [ "$X64_DOWNLOADED" = false ]; then
echo "Trying to extract x64 ffmpeg from npm package..."
mkdir -p ffmpeg-npm-temp
pushd ffmpeg-npm-temp
# 临时安装 ffmpeg-static 并指定 x64 架构
FFMPEG_PLATFORM=darwin FFMPEG_ARCH=x64 npm install --no-save ffmpeg-static@5.2.0 || true
if [ -f node_modules/ffmpeg-static/ffmpeg ]; then
file node_modules/ffmpeg-static/ffmpeg
if file node_modules/ffmpeg-static/ffmpeg | grep -q "x86_64"; then
install -m 755 node_modules/ffmpeg-static/ffmpeg ../vendor/ffmpeg/darwin-x64/ffmpeg
X64_DOWNLOADED=true
echo "✓ Successfully extracted x64 ffmpeg from npm"
else
echo "npm ffmpeg-static artifact is not x86_64"
fi
else
echo "npm ffmpeg-static did not produce ffmpeg binary"
fi
popd
rm -rf ffmpeg-npm-temp
fi
# 验证是否成功获取 x64 版本
if [ "$X64_DOWNLOADED" = false ]; then
echo "ERROR: Failed to obtain x64 ffmpeg from all sources"
exit 1
fi
# 输出原始二进制信息
echo "=== Raw arm64 binary ==="
file vendor/ffmpeg/darwin-arm64/ffmpeg
ls -lh vendor/ffmpeg/darwin-arm64/ffmpeg
shasum -a 256 vendor/ffmpeg/darwin-arm64/ffmpeg || true
lipo -archs vendor/ffmpeg/darwin-arm64/ffmpeg || true
echo "=== Raw x64 binary ==="
file vendor/ffmpeg/darwin-x64/ffmpeg
ls -lh vendor/ffmpeg/darwin-x64/ffmpeg
shasum -a 256 vendor/ffmpeg/darwin-x64/ffmpeg || true
lipo -archs vendor/ffmpeg/darwin-x64/ffmpeg || true
# 生成通用二进制并放入固定目录
echo "Creating universal ffmpeg via lipo"
lipo -create -output vendor/ffmpeg/darwin/ffmpeg \
vendor/ffmpeg/darwin-arm64/ffmpeg \
vendor/ffmpeg/darwin-x64/ffmpeg
chmod +x vendor/ffmpeg/darwin/ffmpeg
echo "=== Universal binary ==="
file vendor/ffmpeg/darwin/ffmpeg
ls -lh vendor/ffmpeg/darwin/ffmpeg
shasum -a 256 vendor/ffmpeg/darwin/ffmpeg || true
lipo -archs vendor/ffmpeg/darwin/ffmpeg || true
# 清理单架构副本
rm -rf vendor/ffmpeg/darwin-arm64 vendor/ffmpeg/darwin-x64
echo "Listing vendor/ffmpeg directory"
find vendor/ffmpeg -maxdepth 2 -type f -exec ls -l {} \;
- name: Prepare Chromaprint (macOS universal)
run: |
set -euxo pipefail
CHROMAPRINT_VERSION="1.5.1"
TAG="v${CHROMAPRINT_VERSION}"
mkdir -p vendor/chromaprint/darwin
curl -L "https://github.com/acoustid/chromaprint/releases/download/${TAG}/chromaprint-fpcalc-${CHROMAPRINT_VERSION}-macos-universal.tar.gz" -o fpcalc-mac.tar.gz
tar -xzf fpcalc-mac.tar.gz
install -m 755 chromaprint-fpcalc-${CHROMAPRINT_VERSION}-macos-universal/fpcalc vendor/chromaprint/darwin/fpcalc
rm -rf fpcalc-mac.tar.gz chromaprint-fpcalc-${CHROMAPRINT_VERSION}-macos-universal
ls -l vendor/chromaprint/darwin
- name: Build Rust N-API for mac (both arch)
working-directory: rust_package
run: |
npx --yes @napi-rs/cli@2.18.4 build --platform --release --target x86_64-apple-darwin
npx --yes @napi-rs/cli@2.18.4 build --platform --release --target aarch64-apple-darwin
- name: Build (vite)
env:
CLOUD_SYNC_BASE_URL_PROD: ${{ secrets.CLOUD_SYNC_BASE_URL_PROD }}
CLOUD_SYNC_API_SECRET_KEY: ${{ secrets.CLOUD_SYNC_API_SECRET_KEY }}
run: pnpm build
- name: Package macOS (universal, no publish)
env:
DEBUG: electron-builder
run: npx electron-builder --mac --universal --publish never
# 不再复制 rc.yml / rc-mac.yml,保持标准文件名
- name: Upload dist artifacts (macOS)
uses: actions/upload-artifact@v4
if: always()
with:
name: mac-artifacts
path: |
dist/*.dmg
dist/*.yml
dist/FRKB-*-mac-universal.zip
dist/FRKB-*-mac-universal.zip.blockmap
dist/*.blockmap
dist/*.zip
release:
needs: [build_win, build_mac]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Show downloaded files
run: ls -R artifacts | cat
- name: Create/Update GitHub Release and upload assets
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/*.exe
artifacts/*.dmg
artifacts/*.yml
artifacts/*.zip
artifacts/*.blockmap
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}