upd: 深度优化 windows 性能仿真浏览器配置 #116
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
publish-linux: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Debug environment | |
run: | | |
chmod +x ./bin/debug-env.sh | |
./bin/debug-env.sh | |
- name: Publish Linux (AppImage and deb) | |
run: npm run publish:linux | |
env: | |
GH_TOKEN: ${{ secrets.atriordsa }} | |
DEBUG: electron-builder | |
publish-windows: | |
runs-on: windows-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Debug environment | |
run: | | |
chmod +x ./bin/debug-env.sh | |
./bin/debug-env.sh | |
- name: Publish Windows | |
run: npm run publish:win | |
env: | |
GH_TOKEN: ${{ secrets.atriordsa }} | |
DEBUG: electron-builder | |
publish-macos: | |
runs-on: macos-latest | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
arch: [x64, arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Debug environment | |
run: | | |
chmod +x ./bin/debug-env.sh | |
./bin/debug-env.sh | |
- name: Debug macOS build environment | |
run: | | |
echo "=== macOS Build Environment (${{ matrix.arch }}) ===" | |
uname -a | |
sw_vers | |
xcodebuild -version || echo "Xcode not available" | |
echo "Available disk space:" | |
df -h | |
echo "Memory usage:" | |
vm_stat | |
echo "Building for architecture: ${{ matrix.arch }}" | |
- name: Publish macOS ${{ matrix.arch }} | |
run: | | |
echo "Starting macOS ${{ matrix.arch }} build with verbose output..." | |
npm run publish:mac:${{ matrix.arch }} | |
env: | |
GH_TOKEN: ${{ secrets.atriordsa }} | |
DEBUG: electron-builder | |
CSC_IDENTITY_AUTO_DISCOVERY: false | |
ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES: true | |
cleanup-release: | |
runs-on: ubuntu-latest | |
needs: [publish-linux, publish-windows, publish-macos] | |
if: always() && (needs.publish-linux.result == 'success' || needs.publish-windows.result == 'success' || needs.publish-macos.result == 'success') | |
permissions: | |
contents: write | |
actions: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Debug GitHub token and permissions | |
run: | | |
chmod +x ./bin/debug-github.sh | |
./bin/debug-github.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.atriordsa }} | |
- name: Clean unwanted files from release | |
run: | | |
chmod +x ./bin/cleanup-release.sh | |
./bin/cleanup-release.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.atriordsa }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_REF_NAME: ${{ github.ref_name }} | |
upload-to-cos: | |
runs-on: ubuntu-latest | |
timeout-minutes: 180 # 3小时超时,适合大文件上传 | |
needs: [cleanup-release] | |
if: always() && needs.cleanup-release.result == 'success' | |
steps: | |
- name: Checkout repository first | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Get release info | |
run: | | |
chmod +x ./bin/get-release-info.sh | |
./bin/get-release-info.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.atriordsa }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_REF_NAME: ${{ github.ref_name }} | |
- name: Download release assets | |
run: | | |
chmod +x ./bin/download-assets.sh | |
./bin/download-assets.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.atriordsa }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_REF_NAME: ${{ github.ref_name }} | |
- name: Create release index | |
run: node scripts/create-release-index.js | |
env: | |
TAG_NAME: ${{ github.ref_name }} | |
CDN_URL: ${{ secrets.CDN_URL }} | |
GITHUB_TOKEN: ${{ secrets.atriordsa }} | |
- name: Upload all files to COS using npm script | |
run: npm run upload:cos | |
env: | |
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }} | |
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }} | |
COS_REGION: ${{ secrets.COS_REGION }} | |
COS_BUCKET: ${{ secrets.COS_BUCKET }} | |
COS_DOMAIN: ${{ secrets.COS_DOMAIN }} | |
TAG_NAME: ${{ github.ref_name }} | |
- name: Display upload summary | |
run: | | |
chmod +x ./bin/display-upload-summary.sh | |
./bin/display-upload-summary.sh | |
env: | |
TAG_NAME: ${{ github.ref_name }} | |
COS_DOMAIN: ${{ secrets.COS_DOMAIN }} | |
CDN_URL: ${{ secrets.CDN_URL }} |