Files
VoiletMark/packaging/build-rpm.sh
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

66 lines
1.8 KiB
Bash
Executable File
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.
#!/usr/bin/env bash
# 把 `make install` 装出来的目录打成 .rpm(用 rpmbuild,不需要 root)
# 用法: build-rpm.sh <安装树> <版本> <x86_64|aarch64> <输出目录>
set -euo pipefail
usage() {
echo "用法: $0 <安装树> <版本> <x86_64|aarch64> <输出目录>" >&2
exit 2
}
[ $# -eq 4 ] || usage
stage=$(cd "$1" && pwd)
version=$2
arch=$3
mkdir -p "$4"
out=$(cd "$4" && pwd)
if [ ! -x "$stage/usr/bin/VoiletMark" ]; then
echo "安装树里找不到 usr/bin/VoiletMark: $stage" >&2
exit 1
fi
repo=$(cd "$(dirname "$0")/.." && pwd)
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
top=$work/rpmbuild
mkdir -p "$top/BUILD" "$top/BUILDROOT" "$top/RPMS" "$top/SOURCES" "$top/SPECS" "$top/SRPMS"
cp -a "$stage" "$top/SOURCES/root"
find "$top/SOURCES/root" -type d -exec chmod 755 {} +
install -Dm644 "$repo/README.md" "$top/SOURCES/root/usr/share/doc/voiletmark/README.md"
cat > "$top/SPECS/voiletmark.spec" <<EOF
Name: voiletmark
Version: $version
Release: 1
Summary: Lightweight cross-platform Markdown editor
License: Proprietary
URL: https://git.linuxacme.com/liyepan/VoiletMark
BuildArch: $arch
AutoReqProv: yes
%description
VoiletMark is a Markdown editor built with Qt 5 and C++17. It renders
Markdown in place, exports PDF, highlights code in 11 languages, edits
tables directly, shows a folder sidebar with document outline and can
run Git commands against the opened repository.
%install
mkdir -p %{buildroot}
cp -a %{_sourcedir}/root/. %{buildroot}/
%files
%defattr(-,root,root,-)
%{_bindir}/VoiletMark
%{_datadir}/applications/voiletmark.desktop
%{_datadir}/icons/hicolor/256x256/apps/voiletmark.png
%{_docdir}/voiletmark/README.md
EOF
rpmbuild --define "_topdir $top" -bb "$top/SPECS/voiletmark.spec" >/dev/null
cp "$top/RPMS/$arch"/*.rpm "$out/"
echo "已生成 $(ls "$out"/*.rpm)"