mirror of
https://github.com/imsyy/SPlayer.git
synced 2025-11-25 03:14:57 +08:00
🐳 chore: 更新工作流
This commit is contained in:
155
.github/workflows/release.yml
vendored
155
.github/workflows/release.yml
vendored
@@ -18,28 +18,45 @@ jobs:
|
||||
matrix:
|
||||
arch: [x64, arm64]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# 检出 Git 仓库
|
||||
- name: Check out git repository
|
||||
uses: actions/checkout@v5
|
||||
# 安装 Node.js
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
# 安装 pnpm
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
|
||||
# 复制环境变量文件
|
||||
- name: Copy .env.example
|
||||
run: |
|
||||
if (-not (Test-Path .env)) {
|
||||
Copy-Item .env.example .env
|
||||
} else {
|
||||
Write-Host ".env file already exists. Skipping the copy step."
|
||||
}
|
||||
# 安装项目依赖
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
# 清理旧的构建产物
|
||||
- name: Clean dist folder
|
||||
run: |
|
||||
if (Test-Path dist) {
|
||||
Remove-Item -Recurse -Force dist
|
||||
}
|
||||
# 构建 Electron App
|
||||
- name: Build Electron App (Windows)
|
||||
run: pnpm run build:win -- --${{ matrix.arch }}
|
||||
run: pnpm run build:win -- --${{ matrix.arch }} || true
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
# 上传构建产物
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: SPlayer-Win-${{ matrix.arch }}
|
||||
name: SPlayer-Win-${{ matrix.arch }
|
||||
if-no-files-found: ignore
|
||||
path: |
|
||||
dist/*.exe
|
||||
dist/*.exe.blockmap
|
||||
@@ -54,28 +71,43 @@ jobs:
|
||||
matrix:
|
||||
arch: [x64, arm64]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# 检出 Git 仓库
|
||||
- name: Check out git repository
|
||||
uses: actions/checkout@v5
|
||||
# 安装 Node.js
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
# 安装 pnpm
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
|
||||
# 复制环境变量文件
|
||||
- name: Copy .env.example
|
||||
run: |
|
||||
if [ ! -f .env ]; then
|
||||
cp .env.example .env
|
||||
else
|
||||
echo ".env file already exists. Skipping the copy step."
|
||||
fi
|
||||
# 安装项目依赖
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
# 清理旧的构建产物
|
||||
- name: Clean dist folder
|
||||
run: rm -rf dist
|
||||
# 构建 Electron App
|
||||
- name: Build Electron App (macOS)
|
||||
run: pnpm run build:mac -- --${{ matrix.arch }}
|
||||
run: pnpm run build:mac -- --${{ matrix.arch }} || true
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
# 上传构建产物
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: SPlayer-macOS-${{ matrix.arch }}
|
||||
if-no-files-found: ignore
|
||||
path: |
|
||||
dist/*.dmg
|
||||
dist/*.zip
|
||||
@@ -89,31 +121,62 @@ jobs:
|
||||
matrix:
|
||||
arch: [x64, arm64]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# 检出 Git 仓库
|
||||
- name: Check out git repository
|
||||
uses: actions/checkout@v5
|
||||
# 安装 Node.js
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
# 安装 pnpm
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
|
||||
- name: Install build dependencies
|
||||
# 更新 Ubuntu 软件源
|
||||
- name: Ubuntu Update with sudo
|
||||
run: sudo apt-get update
|
||||
# 安装依赖
|
||||
- name: Install RPM & Pacman
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends -y rpm libarchive-tools libopenjp2-tools
|
||||
|
||||
sudo apt-get install --no-install-recommends -y rpm &&
|
||||
sudo apt-get install --no-install-recommends -y libarchive-tools &&
|
||||
sudo apt-get install --no-install-recommends -y libopenjp2-tools
|
||||
# 安装 Snapcraft
|
||||
- name: Install Snapcraft
|
||||
uses: samuelmeuli/action-snapcraft@v2
|
||||
# 复制环境变量文件
|
||||
- name: Copy .env.example
|
||||
run: |
|
||||
if [ ! -f .env ]; then
|
||||
cp .env.example .env
|
||||
else
|
||||
echo ".env file already exists. Skipping the copy step."
|
||||
fi
|
||||
# 安装项目依赖
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
# 清理旧的构建产物
|
||||
- name: Clean dist folder
|
||||
run: rm -rf dist
|
||||
# 构建 Electron App
|
||||
- name: Build Electron App (Linux)
|
||||
run: pnpm run build:linux -- --${{ matrix.arch }}
|
||||
run: pnpm run build:linux -- --${{ matrix.arch }} || true
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
|
||||
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
# 上传 Snap 包到 Snapcraft 商店
|
||||
- name: Publish Snap to Snap Store
|
||||
run: |
|
||||
if [ -f dist/*.snap ]; then
|
||||
snapcraft upload dist/*.snap --release stable || echo "Snap upload failed or not configured"
|
||||
fi
|
||||
continue-on-error: true
|
||||
# 上传构建产物
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: SPlayer-Linux-${{ matrix.arch }}
|
||||
if-no-files-found: ignore
|
||||
path: |
|
||||
dist/*.AppImage
|
||||
dist/*.deb
|
||||
@@ -131,22 +194,24 @@ jobs:
|
||||
- build-macos
|
||||
- build-linux
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
# 需要写入权限才能创建 Release 和上传产物
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# 下载各平台构建产物
|
||||
# 将所有产物下载到 artifacts 文件夹
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: List downloaded artifacts
|
||||
# 列出下载的产物(用于调试)
|
||||
- name: List downloaded artifacts (for debugging)
|
||||
run: ls -R artifacts
|
||||
|
||||
# 通过 electron-builder 上传 Release 和 latest.yml
|
||||
- name: Publish via electron-builder
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm run build:publish
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# 创建 GitHub Release 并上传所有产物
|
||||
- name: Create GitHub Release and Upload Assets
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
# 生成发布说明
|
||||
generate_release_notes: true
|
||||
# 全部上传
|
||||
files: |
|
||||
artifacts/**/*
|
||||
|
||||
Reference in New Issue
Block a user