Files
VoiletMark/.github/workflows/linux-packages.yml
T
liyepan 5077a08a5c
Linux 安装包 / aarch64 · deb + rpm (push) Canceled after 0s
Linux 安装包 / x86_64 · deb + rpm (push) Canceled after 0s
Linux 安装包 / 发布到 Release (push) Canceled after 0s
feat: v0.12.2 —— GitHub Actions 打 deb / rpm(x86_64 + aarch64)
- 新增 .github/workflows/linux-packages.yml(Gitea 不跑,给 GitHub 镜像用)
  推送 / 打 tag / 手动触发 / PR 时编译,并用下面两个脚本打出安装包
- packaging/build-deb.sh:把 make install 的目录打成 .deb(含依赖、README)
- packaging/build-rpm.sh:用 rpmbuild 打成 .rpm(文件布局、%defattr 都设好)
- x86_64 用 ubuntu-22.04 runner,aarch64 用 ubuntu-24.04-arm(公共仓库才有,
  私有仓库里 ARM 那一步失败不影响 x86_64 的包)
- 构建产物上传 artifact;打 tag 时自动生成 SHA256SUMS 并挂到 Release
- README 补「打包(Linux)」一节,.gitignore 忽略本地 dist/*.deb/*.rpm
2026-10-23 13:47:34 +08:00

136 lines
3.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Linux 安装包
# 仓库本身在 Gitea,这个工作流是给 GitHub 镜像用的:
# 推送、打 tag(v*)、手动触发、PR 检查时编译并打出 .deb / .rpm。
on:
push:
branches: [main, master]
tags: ["v*"]
pull_request:
workflow_dispatch:
permissions:
contents: write
concurrency:
group: packages-${{ github.ref }}
cancel-in-progress: true
jobs:
package:
name: ${{ matrix.arch }} · deb + rpm
runs-on: ${{ matrix.runs-on }}
# ARM runner 只有公共仓库(或自建 arm64 runner)才有;私有仓库里这一步失败
# 不算整体失败,x86_64 的包照常产出。
continue-on-error: ${{ matrix.optional }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runs-on: ubuntu-22.04
deb_arch: amd64
rpm_arch: x86_64
optional: false
- arch: aarch64
runs-on: ubuntu-24.04-arm
deb_arch: arm64
rpm_arch: aarch64
optional: true
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 安装构建依赖
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential file \
qtbase5-dev qtbase5-dev-tools qt5-qmake \
rpm dpkg-dev
- name: 读取版本号
id: meta
run: |
version=$(sed -n 's/^VERSION[[:space:]]*=[[:space:]]*//p' VoiletMark.pro | head -n1 | tr -d '[:space:]')
if [ -z "$version" ]; then
echo "VoiletMark.pro 里没有 VERSION" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: 编译
run: |
qmake_bin=$(command -v qmake-qt5 || command -v qmake || true)
if [ -z "$qmake_bin" ]; then
echo "找不到 qmake(确认装了 qtbase5-dev / qt5-qmake)" >&2
exit 1
fi
"$qmake_bin" -v
mkdir -p build
cd build
"$qmake_bin" ../VoiletMark.pro PREFIX=/usr CONFIG+=release
make -j"$(nproc)"
make install INSTALL_ROOT="$PWD/stage"
find stage -type f | sort
- name: 打 .deb
run: |
./packaging/build-deb.sh build/stage "${{ steps.meta.outputs.version }}" "${{ matrix.deb_arch }}" dist
- name: 打 .rpm
run: |
./packaging/build-rpm.sh build/stage "${{ steps.meta.outputs.version }}" "${{ matrix.rpm_arch }}" dist
- name: 检查产物
run: |
ls -lh dist
dpkg-deb -I dist/*.deb
rpm -qpi dist/*.rpm
rpm -qpl dist/*.rpm
- name: 上传构建产物
uses: actions/upload-artifact@v4
with:
name: voiletmark-${{ matrix.arch }}
path: dist/*
if-no-files-found: error
release:
name: 发布到 Release
needs: package
# ARM 那个 job 可能因为拿不到 arm runner 而失败,这里用 !cancelled() 照常收尾;
# 下面单独检查 x86_64 的包在不在,缺了就不发 Release。
if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: 下载所有产物
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: 确认 x86_64 的包存在
run: |
ls -lh dist
test -n "$(ls dist/*amd64.deb 2>/dev/null)" || {
echo "没有 x86_64 的 deb,不发布" >&2
exit 1
}
- name: 生成 SHA256SUMS
run: |
cd dist
sha256sum ./*.deb ./*.rpm > SHA256SUMS
cat SHA256SUMS
- name: 挂到对应 tag 的 Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true
fail_on_unmatched_files: true