feat: build deb and rpm packages for all linux architectures

This commit is contained in:
peoplemiau1
2026-06-02 13:50:57 +03:00
parent ef9ca57295
commit 7d853482aa

View File

@@ -205,41 +205,73 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: package_type: [deb, rpm, arch, snap]
- package_type: deb target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, i686-unknown-linux-gnu, armv7-unknown-linux-gnueabihf, riscv64gc-unknown-linux-gnu]
artifact_name: debian-package exclude:
- package_type: rpm
artifact_name: rpm-package
- package_type: arch - package_type: arch
artifact_name: arch-package target: aarch64-unknown-linux-gnu
- package_type: arch
target: i686-unknown-linux-gnu
- package_type: arch
target: armv7-unknown-linux-gnueabihf
- package_type: arch
target: riscv64gc-unknown-linux-gnu
- package_type: snap - package_type: snap
artifact_name: snap-package target: aarch64-unknown-linux-gnu
- package_type: snap
target: i686-unknown-linux-gnu
- package_type: snap
target: armv7-unknown-linux-gnueabihf
- package_type: snap
target: riscv64gc-unknown-linux-gnu
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
ref: ${{ needs.setup.outputs.tag }} ref: ${{ needs.setup.outputs.tag }}
- name: Setup Rust (For non-container builds) - name: Install cargo-zigbuild
if: matrix.package_type == 'deb' || matrix.package_type == 'rpm'
run: |
pip install cargo-zigbuild
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Setup Zig
if: (matrix.package_type == 'deb' || matrix.package_type == 'rpm') && matrix.target != 'x86_64-unknown-linux-gnu'
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- name: Setup Rust
if: matrix.package_type != 'arch' if: matrix.package_type != 'arch'
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# ── DEB Build ── # ── DEB Build ──
- name: Build Debian Package - name: Build Debian Package
if: matrix.package_type == 'deb' if: matrix.package_type == 'deb'
run: | run: |
cargo install cargo-deb cargo install cargo-deb
cargo build --release if [ "${{ matrix.target }}" != "x86_64-unknown-linux-gnu" ]; then
cargo deb --no-build cargo zigbuild --release --target ${{ matrix.target }}
mkdir -p dist-packages && cp target/debian/*.deb dist-packages/ else
cargo build --release --target ${{ matrix.target }}
fi
cargo deb --no-build --target ${{ matrix.target }}
mkdir -p dist-packages && cp target/${{ matrix.target }}/debian/*.deb dist-packages/
# ── RPM Build ── # ── RPM Build ──
- name: Build RPM Package - name: Build RPM Package
if: matrix.package_type == 'rpm' if: matrix.package_type == 'rpm'
run: | run: |
cargo install cargo-generate-rpm cargo install cargo-generate-rpm
cargo build --release if [ "${{ matrix.target }}" != "x86_64-unknown-linux-gnu" ]; then
cargo generate-rpm cargo zigbuild --release --target ${{ matrix.target }}
mkdir -p dist-packages && cp target/generate-rpm/*.rpm dist-packages/ else
cargo build --release --target ${{ matrix.target }}
fi
cargo generate-rpm --target ${{ matrix.target }}
mkdir -p dist-packages && cp target/${{ matrix.target }}/generate-rpm/*.rpm dist-packages/
# ── Snap Build ── # ── Snap Build ──
- name: Build Snap Package - name: Build Snap Package
@@ -311,7 +343,7 @@ jobs:
- name: Upload Package Artifact - name: Upload Package Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ matrix.artifact_name }} name: ${{ matrix.package_type }}-package-${{ matrix.target }}
path: dist-packages/* path: dist-packages/*
if-no-files-found: ignore if-no-files-found: ignore
@@ -336,10 +368,10 @@ jobs:
with: with:
tag_name: ${{ needs.setup.outputs.tag }} tag_name: ${{ needs.setup.outputs.tag }}
files: | files: |
collected-packages/debian-package/* collected-packages/deb-package-*/*
collected-packages/rpm-package/* collected-packages/rpm-package-*/*
collected-packages/arch-package/* collected-packages/arch-package-*/*
collected-packages/snap-package/* collected-packages/snap-package-*/*
body_path: .github/release-notes.md body_path: .github/release-notes.md
prerelease: ${{ needs.setup.outputs.prerelease == 'true' }} prerelease: ${{ needs.setup.outputs.prerelease == 'true' }}