This commit is contained in:
teasiu
2026-04-19 10:54:17 +08:00
parent 556cc2d6b3
commit dfbe230899
2 changed files with 44 additions and 43 deletions

View File

@@ -1,28 +1,26 @@
# .github/workflows/build.yml name: Build Multi-Arch Binaries (Direct Release Upload)
name: Build Multi-Arch Binaries
on: on:
workflow_dispatch: # 支持手动触发 workflow_dispatch:
env: env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs: jobs:
build: build:
name: Build ${{ matrix.arch }} name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- arch: x86_64 - arch: x86_64
platform: linux/amd64 platform: linux/amd64
python-arch: x64
- arch: arm64 - arch: arm64
platform: linux/arm64 platform: linux/arm64
python-arch: arm64
- arch: armhf - arch: armhf
platform: linux/arm/v7 platform: linux/arm/v7
python-arch: arm
steps: steps:
- name: Checkout - name: Checkout
@@ -31,47 +29,51 @@ jobs:
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Build binary in Docker - name: Build binary (Ubuntu 20.04)
run: | run: |
docker run --rm \ docker run --rm \
--platform ${{ matrix.platform }} \ --platform=${{ matrix.platform }} \
-v "${{ github.workspace }}:/workspace" \ -v "${{ github.workspace }}:/workspace" \
-w /workspace \ -w /workspace \
python:3.11 \ ubuntu:20.04 \
bash -c " bash -euxo pipefail -c '
set -e apt-get update
apt-get update -qq && apt-get install -y -q binutils \
build-essential python3-dev apt-get install -y \
pip install --upgrade pip -q python3 \
pip install pyinstaller fastapi uvicorn aiofiles \ python3-pip \
pydantic python-multipart httptools -q python3-dev \
build-essential \
binutils
pip3 install --upgrade pip
pip3 install \
pyinstaller \
fastapi \
uvicorn \
aiofiles \
pydantic \
python-multipart
pyinstaller nas-media-player.spec --clean --noconfirm pyinstaller nas-media-player.spec --clean --noconfirm
mkdir -p releases
cp dist/nas-media-player releases/nas-media-player-${{ matrix.arch }}
chmod +x releases/nas-media-player-${{ matrix.arch }}
"
- name: Upload artifact mkdir -p dist_release
uses: actions/upload-artifact@v4 cp dist/nas-media-player dist_release/nas-media-player-${{ matrix.arch }}
with: chmod +x dist_release/nas-media-player-${{ matrix.arch }}
name: nas-media-player-${{ matrix.arch }} '
path: releases/nas-media-player-${{ matrix.arch }}
release: - name: Generate timestamp tag (shared logic)
name: Create Release id: tag
needs: build run: |
runs-on: ubuntu-latest echo "TAG=build-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
if: startsWith(github.ref, 'refs/tags/')
steps: - name: Upload to GitHub Release (direct)
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: releases/
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
files: releases/* tag_name: ${{ steps.tag.outputs.TAG }}
generate_release_notes: true name: Release ${{ steps.tag.outputs.TAG }}
files: dist_release/nas-media-player-${{ matrix.arch }}
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -30,7 +30,6 @@ pip install \
aiofiles \ aiofiles \
pydantic \ pydantic \
python-multipart \ python-multipart \
httptools \
-q -q
# 4. 执行打包 # 4. 执行打包