Files
AlgerMusicPlayer/.github/workflows/build.yml
alger bf341fa7c8 feat(update): 重构自动更新系统,使用 electron-updater 替代手动下载
- CI 构建 macOS 拆分为 x64/arm64 分别构建,合并 latest-mac.yml
- 主进程使用 electron-updater 管理检查、下载、安装全流程
- 渲染进程 UpdateModal 改为响应式同步主进程更新状态
- IPC 通道统一为 app-update:* 系列
- 窗口拦截外部链接在系统浏览器打开
- 新增 5 语言更新相关国际化文案
2026-03-11 22:30:35 +08:00

116 lines
3.0 KiB
YAML

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- id: mac-x64
os: macos-latest
build_command: npm run build:mac:x64
- id: mac-arm64
os: macos-latest
build_command: npm run build:mac:arm64
- id: windows
os: windows-latest
build_command: npm run build:win
- id: linux
os: ubuntu-latest
build_command: npm run build:linux
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Install dependencies
run: npm ci
- name: Install Linux build dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Build artifacts
run: ${{ matrix.build_command }}
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
- name: Prepare mac update metadata
if: startsWith(matrix.id, 'mac-')
run: rm -f dist/latest-mac.yml
- name: Upload release bundle
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.id }}
if-no-files-found: error
path: |
dist/*.dmg
dist/*.zip
dist/*.exe
dist/*.deb
dist/*.rpm
dist/*.AppImage
dist/latest*.yml
dist/*.blockmap
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Get version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Read release notes
run: |
NOTES=$(awk "/## \[v${{ env.VERSION }}\]/{p=1;print;next} /## \[v/{p=0}p" CHANGELOG.md)
echo "NOTES<<EOF" >> $GITHUB_ENV
echo "$NOTES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
- name: Prepare release files
run: |
mkdir -p release-upload
find release-artifacts -type f \
! -name 'latest-mac-x64.yml' \
! -name 'latest-mac-arm64.yml' \
-exec cp {} release-upload/ \;
node scripts/merge_latest_mac_yml.mjs \
release-artifacts/mac-x64/latest-mac-x64.yml \
release-artifacts/mac-arm64/latest-mac-arm64.yml \
release-upload/latest-mac.yml
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
body: ${{ env.NOTES }}
draft: false
prerelease: false
files: release-upload/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}