Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,48 @@ jobs:
name: patchsplit-debian-amd64
path: debian-artifacts/patchsplit_*.deb
if-no-files-found: error

build-rpm:
name: Build RPM package
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build RPM package in Fedora
shell: bash
run: |
set -euo pipefail
mkdir -p rpm-artifacts
version=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n 1)
git archive --format=tar.gz --prefix="patchsplit-${version}/" HEAD \
-o "patchsplit-${version}.tar.gz"
docker run --rm \
-v "$GITHUB_WORKSPACE:/workspace:ro" \
-v "$GITHUB_WORKSPACE/rpm-artifacts:/artifacts" \
-w /tmp \
fedora:latest \
bash -euxo pipefail -c '
dnf install -y \
cargo \
gcc \
make \
redhat-rpm-config \
rpm-build \
rust
version=$(sed -n "s/^version = \"\\([^\"]*\\)\"/\\1/p" /workspace/Cargo.toml | head -n 1)
topdir=/tmp/rpmbuild
mkdir -p "$topdir"/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
cp "/workspace/patchsplit-${version}.tar.gz" "$topdir/SOURCES/"
cp /workspace/packaging/patchsplit.spec "$topdir/SPECS/"
rpmbuild --define "_topdir $topdir" -bb "$topdir/SPECS/patchsplit.spec"
cp "$topdir"/RPMS/*/patchsplit-*.rpm /artifacts/
'

- name: Upload RPM package
uses: actions/upload-artifact@v4
with:
name: patchsplit-rpm-x86_64
path: rpm-artifacts/patchsplit-*.rpm
if-no-files-found: error
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
path: artifacts
merge-multiple: true

- name: Verify RPM package
run: test -n "$(find artifacts -type f -name '*.rpm' -print -quit)"

- name: Create Draft Release
env:
GH_TOKEN: ${{ github.token }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ debian/cargo-target/
cargo_home
cargo_registry
debian/patchsplit.debhelper.log

# RPM packaging build artifacts
rpm-artifacts/
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ exist, it will point to the workflow commit. The workflow creates these files:
- `patchsplit-macos-x86_64.tar.gz`
- `patchsplit-windows-x86_64.zip`
- `patchsplit_<version>_amd64.deb`
- `patchsplit-<version>-<release>.*.x86_64.rpm`

Releases are created as drafts, so they should be reviewed and published from
the GitHub Releases page.
Expand All @@ -105,6 +106,16 @@ On Debian and Ubuntu, download the `.deb` release asset and install it with:
sudo apt install ./patchsplit_<version>_amd64.deb
```

On Fedora, RHEL, and compatible distributions, download the `.rpm` release
asset and install it with:

```sh
sudo dnf install ./patchsplit-*.x86_64.rpm
```

If the release also includes a debuginfo package, install the main package
`patchsplit-<version>-<release>.x86_64.rpm` instead of the debuginfo package.

> [!NOTE]
> For Arch Linux, use the [`patchsplit-bin`](https://aur.archlinux.org/packages/patchsplit-bin) AUR package
> maintained by [lingbopro](https://github.com/lingbopro).
Expand Down
10 changes: 10 additions & 0 deletions README_zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ git push origin v1.x.x
- `patchsplit-macos-x86_64.tar.gz`
- `patchsplit-windows-x86_64.zip`
- `patchsplit_<version>_amd64.deb`
- `patchsplit-<version>-<release>.*.x86_64.rpm`

release 默认是草稿,需要在 GitHub Releases 页面检查后手动发布。

Expand All @@ -107,6 +108,15 @@ release 默认是草稿,需要在 GitHub Releases 页面检查后手动发布
sudo apt install ./patchsplit_<version>_amd64.deb
```

在 Fedora、RHEL 及兼容发行版上,下载 release 中的 `.rpm` 文件并执行:

```sh
sudo dnf install ./patchsplit-*.x86_64.rpm
```

如果 release 中同时提供了 debuginfo 包,请安装主包
`patchsplit-<version>-<release>.x86_64.rpm`,不要安装 debuginfo 包。

```sh
tar -xzf patchsplit-linux-x86_64.tar.gz
chmod +x patchsplit
Expand Down
3 changes: 2 additions & 1 deletion packaging/patchsplit.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Source0: %{name}-%{version}.tar.gz

BuildRequires: rust
BuildRequires: cargo
BuildRequires: gcc

%description
Patchsplit is a command-line tool for splitting patch files into
Expand Down Expand Up @@ -41,4 +42,4 @@ install -Dm644 packaging/patchsplit.1 \

%changelog
* Sun Sep 13 2026 Oliver Lin <oliver@liuxiaozhen.dev> - 1.0.4-1
- Initial RPM package
- Initial RPM package
Loading