* feat(cli): locate ffmpeg via ffmpeg_path / host / PATH and start child processes without console windows - New `tools` module in both crates. `tools::command()` starts external programs with CREATE_NO_WINDOW on Windows; every ffmpeg, streamlink, yt-dlp, ytarchive and hook shell process now goes through it. - ffmpeg is looked up in this order: the new optional `ffmpeg_path` setting, then `ServeOptions::ffmpeg` (for an ffmpeg shipped by the embedding host), then `ffmpeg` on PATH. Unset keeps today's behaviour. - `ffmpeg_path` is global (not overridable per streamer) and visible in the redacted configuration. * feat(api): GET /v1/tools reports ffmpeg availability, version and license Read-only, allowed for every logged-in role. Returns whether the ffmpeg that would be used runs, where it came from (config / bundled / path), the first line of `ffmpeg -version` (cached per program; failures are retried) and the license derived from its configure flags. Errors say what to fix. * feat(desktop): bundle ffmpeg in the Windows installer, same BtbN build as Docker - desktop-publish.yml downloads the BtbN win64 GPL static zip of the tag and version the Dockerfile pins (read by .github/scripts/ffmpeg-version.sh), checks its SHA-256 and ships only ffmpeg.exe, LICENSE.txt and a README with the source links as bundle resources (tauri.ffmpeg.conf.json), installed under ffmpeg\. - The shell passes resource_dir()/ffmpeg/ffmpeg.exe to ServeOptions::ffmpeg when the file exists. The ffmpeg_path setting still wins; builds without the overlay keep using PATH. * ci(desktop): attach the FFmpeg corresponding source and download notes to releases - New ffmpeg-source job: FFmpeg at the pinned commit, the BtbN build scripts at the pinned tag, and the source of every library those scripts build (fetched by their own download.sh at the commits pinned in scripts.d/), plus a README and SHA256SUMS. Uploaded on release events only; manual runs just list the files. - On release events, append .github/desktop-release-notes.md to the release body once: setup.exe is the recommended download, and how to get past the browser warning and SmartScreen while it is unsigned. * fix(cli): only use CREATE_NO_WINDOW when biliup has no console `biliup server` in a Windows terminal keeps sharing its console with the programs it starts, as before: Ctrl+C and their output still reach the terminal. Only a process without a console window (the desktop app) starts them with CREATE_NO_WINDOW. The choice is logged at startup and covered by a Windows-only test that runs itself as a child with and without a console. * ci(desktop): link to the upstream FFmpeg source instead of uploading it to releases Drop the ffmpeg-source job that packed about 2 GB of FFmpeg and dependency source into every release. The installer's ffmpeg/README.txt and the release notes now point to the FFmpeg commit and the BtbN/FFmpeg-Builds tree of the bundled build (full commit hashes, resolved at build time), whose scripts.d/ pins the version and source URL of every library. The Docker image uses the same BtbN tag, so the same links cover it.
131 lines
5.5 KiB
YAML
131 lines
5.5 KiB
YAML
name: Desktop (Windows)
|
||
|
||
on:
|
||
release:
|
||
types: [created]
|
||
# 手动触发只构建,安装包作为 artifact 上传,不碰 Release
|
||
workflow_dispatch:
|
||
|
||
permissions:
|
||
contents: read
|
||
|
||
env:
|
||
# BtbN win64 GPL 静态构建 zip 的 SHA-256。tag 与版本号取自 Dockerfile(与 Docker 镜像同一构建),
|
||
# 见 .github/scripts/ffmpeg-version.sh;Dockerfile 升级 FFmpeg 时同步更新这里。
|
||
FFMPEG_WIN64_SHA256: 273abb45f3f9f76c303e35ff39f5bb6c23c163ae65f6244a32b7d4a7f6cf0616
|
||
|
||
jobs:
|
||
build:
|
||
permissions:
|
||
contents: write
|
||
runs-on: 'windows-latest'
|
||
steps:
|
||
- uses: actions/checkout@v7
|
||
- uses: actions/setup-node@v7
|
||
with:
|
||
node-version: lts/*
|
||
# biliup-cli 通过 rust-embed 把 out/ 编进桌面程序
|
||
- name: Build frontend
|
||
run: |
|
||
npm install
|
||
npm run build
|
||
# 只取 ffmpeg.exe 和许可文本,由 tauri.ffmpeg.conf.json 作为资源打进安装包(安装目录下的 ffmpeg\)。
|
||
# GPL 对应源码不由我们托管:README.txt 和 Release 说明链接到上游固定 commit 的 FFmpeg 源码
|
||
# 与 BtbN 构建脚本(scripts.d/ 固定了各依赖的版本与源码地址)。
|
||
- name: Download FFmpeg
|
||
shell: bash
|
||
env:
|
||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
run: |
|
||
eval "$(bash .github/scripts/ffmpeg-version.sh)"
|
||
# tag 可以被移动,链接用完整 commit
|
||
ffmpeg_sha=$(gh api "repos/FFmpeg/FFmpeg/commits/${FFMPEG_COMMIT}" --jq .sha)
|
||
btbn_sha=$(gh api "repos/BtbN/FFmpeg-Builds/commits/${FFMPEG_TAG}" --jq .sha)
|
||
[[ $ffmpeg_sha == "${FFMPEG_COMMIT}"* && ${#btbn_sha} == 40 ]] || {
|
||
echo "cannot resolve FFmpeg ${FFMPEG_COMMIT} / BtbN ${FFMPEG_TAG}: '${ffmpeg_sha}' '${btbn_sha}'" >&2
|
||
exit 1
|
||
}
|
||
{
|
||
echo "FFMPEG_TAG=${FFMPEG_TAG}"
|
||
echo "FFMPEG_VERSION=${FFMPEG_VERSION}"
|
||
echo "FFMPEG_SOURCE_URL=https://github.com/FFmpeg/FFmpeg/tree/${ffmpeg_sha}"
|
||
echo "FFMPEG_BUILD_SCRIPTS_URL=https://github.com/BtbN/FFmpeg-Builds/tree/${btbn_sha}"
|
||
} >> "$GITHUB_ENV"
|
||
asset="ffmpeg-${FFMPEG_VERSION}-win64-gpl-${FFMPEG_BRANCH}"
|
||
curl -fsSL --retry 3 -o ffmpeg.zip \
|
||
"https://github.com/BtbN/FFmpeg-Builds/releases/download/${FFMPEG_TAG}/${asset}.zip"
|
||
echo "${FFMPEG_WIN64_SHA256} ffmpeg.zip" | sha256sum -c -
|
||
dest=tauri-app/src-tauri/ffmpeg
|
||
mkdir -p "$dest"
|
||
unzip -j -o ffmpeg.zip "${asset}/bin/ffmpeg.exe" "${asset}/LICENSE.txt" -d "$dest"
|
||
cat > "$dest/README.txt" <<EOF
|
||
FFmpeg ${FFMPEG_VERSION} (win64, GPL, static), built by BtbN/FFmpeg-Builds ${FFMPEG_TAG}.
|
||
The biliup Docker image uses the linux64 / linuxarm64 builds of the same tag.
|
||
|
||
FFmpeg is licensed under the GNU General Public License version 3 or later
|
||
(see LICENSE.txt in this folder). biliup runs it as a separate program.
|
||
|
||
Corresponding source code, hosted upstream:
|
||
FFmpeg source at commit ${ffmpeg_sha}:
|
||
https://github.com/FFmpeg/FFmpeg/tree/${ffmpeg_sha}
|
||
Build scripts and patches, BtbN/FFmpeg-Builds ${FFMPEG_TAG} (commit ${btbn_sha}):
|
||
https://github.com/BtbN/FFmpeg-Builds/tree/${btbn_sha}
|
||
scripts.d/ pins the version and source URL of every library FFmpeg is
|
||
built with; download.sh in the same tree fetches all of them.
|
||
EOF
|
||
ls -l "$dest"
|
||
rm ffmpeg.zip
|
||
- name: Render download notes
|
||
shell: bash
|
||
run: |
|
||
sed -e "s|{{FFMPEG_VERSION}}|${FFMPEG_VERSION}|g" \
|
||
-e "s|{{FFMPEG_TAG}}|${FFMPEG_TAG}|g" \
|
||
-e "s|{{FFMPEG_SOURCE_URL}}|${FFMPEG_SOURCE_URL}|g" \
|
||
-e "s|{{FFMPEG_BUILD_SCRIPTS_URL}}|${FFMPEG_BUILD_SCRIPTS_URL}|g" \
|
||
.github/desktop-release-notes.md > desktop-notes.md
|
||
if grep -n '{{' desktop-notes.md; then exit 1; fi
|
||
cat desktop-notes.md
|
||
- name: install Rust stable
|
||
uses: dtolnay/rust-toolchain@stable
|
||
- uses: Swatinem/rust-cache@v2
|
||
with:
|
||
workspaces: tauri-app/src-tauri -> target
|
||
- name: install Tauri CLI
|
||
working-directory: tauri-app
|
||
run: npm ci
|
||
- name: Build and upload to the release
|
||
if: github.event_name == 'release'
|
||
uses: tauri-apps/tauri-action@v1
|
||
env:
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
with:
|
||
# 用 releaseId 而不是 tagName:v1 找到已发布的 Release 时会用 releaseName/releaseBody 覆盖它的标题和正文
|
||
releaseId: ${{ github.event.release.id }}
|
||
projectPath: tauri-app
|
||
args: --config src-tauri/tauri.ffmpeg.conf.json
|
||
- name: Add download notes to the release
|
||
if: github.event_name == 'release'
|
||
shell: bash
|
||
env:
|
||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
TAG: ${{ github.event.release.tag_name }}
|
||
run: |
|
||
body=$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json body --jq .body)
|
||
if ! grep -q 'biliup-desktop-notes' <<<"$body"; then
|
||
printf '%s\n\n%s\n' "$body" "$(cat desktop-notes.md)" > notes.md
|
||
gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --notes-file notes.md
|
||
fi
|
||
- name: Build
|
||
if: github.event_name != 'release'
|
||
uses: tauri-apps/tauri-action@v1
|
||
with:
|
||
projectPath: tauri-app
|
||
args: --config src-tauri/tauri.ffmpeg.conf.json
|
||
- uses: actions/upload-artifact@v7
|
||
if: github.event_name != 'release'
|
||
with:
|
||
name: biliup-desktop-windows
|
||
path: |
|
||
tauri-app/src-tauri/target/release/bundle/nsis/*.exe
|
||
tauri-app/src-tauri/target/release/bundle/msi/*.msi
|