Some checks failed
CI/CD Pipeline / Code Format (push) Failing after 6s
CI/CD Pipeline / Clippy Lints (push) Failing after 11s
CI/CD Pipeline / Unit Tests (push) Failing after 1s
CI/CD Pipeline / Build Debian Package (push) Has been skipped
CI/CD Pipeline / Build RPM Package (push) Has been skipped
CI/CD Pipeline / Build Alpine Package (push) Has been skipped
CI/CD Pipeline / Build Arch Package (push) Has been skipped
CI/CD Pipeline / Security Audit (push) Failing after 1s
- Replace generic "linux" runner label with dedicated per-OS labels (ubuntu-24.04, fedora, alpine, arch) - Remove all container declarations (native runner execution) - Add build gate dependencies: build jobs need fmt+clippy+test - Extract release upload logic into reusable scripts/upload-release.sh - Fix build-alpine.sh: remove hardcoded container paths, add SKIP_CARGO_BUILD support - Fix build-arch.sh: remove hardcoded container paths, add SKIP_CARGO_BUILD support - Fix build-rpm.sh: remove sudo, native runner compatible - Remove Dockerfile.rpm and Dockerfile.arch (no longer needed) - Add sudo to Ubuntu/Fedora/Arch package installs for safety - Add nodejs to Alpine deps for Gitea Actions compatibility - Make upload-release.sh POSIX sh compatible (Alpine) - Fix curl -sf to curl -s in upload-release.sh (404 on new releases)
64 lines
1.9 KiB
Bash
Executable File
64 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build RPM Package for RHEL/CentOS/Fedora
|
|
# Run on: RHEL 8/9, CentOS 8/9, Fedora 38+
|
|
# Designed for native Gitea Actions runner execution
|
|
|
|
set -e
|
|
|
|
echo "=== Linux Patch API - RPM Build Script ==="
|
|
echo ""
|
|
|
|
# Check if running on RPM-based system
|
|
if ! command -v rpmbuild &> /dev/null; then
|
|
echo "Installing RPM build tools..."
|
|
if command -v dnf &> /dev/null; then
|
|
dnf install -y rpm-build cargo rust gcc systemd-devel
|
|
elif command -v yum &> /dev/null; then
|
|
yum install -y rpm-build cargo rust gcc systemd-devel
|
|
else
|
|
echo "Error: Cannot install rpm-build. Please install manually."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Setup RPM build directory structure
|
|
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
|
|
|
# Create source tarball (required by %autosetup in spec file)
|
|
echo "Creating source tarball..."
|
|
VERSION="1.0.0"
|
|
TMPDIR=$(mktemp -d)
|
|
mkdir -p "$TMPDIR/linux-patch-api-${VERSION}"
|
|
# Copy files excluding unwanted directories using find
|
|
cp -r . "$TMPDIR/linux-patch-api-${VERSION}/"
|
|
rm -rf "$TMPDIR/linux-patch-api-${VERSION}/target"
|
|
rm -rf "$TMPDIR/linux-patch-api-${VERSION}/.git"
|
|
rm -rf "$TMPDIR/linux-patch-api-${VERSION}/releases"
|
|
rm -rf "$TMPDIR/linux-patch-api-${VERSION}/.github"
|
|
rm -rf "$TMPDIR/linux-patch-api-${VERSION}/debian"
|
|
tar -czf ~/rpmbuild/SOURCES/linux-patch-api-${VERSION}.tar.gz -C "$TMPDIR" "linux-patch-api-${VERSION}"
|
|
rm -rf "$TMPDIR"
|
|
|
|
# Copy spec file
|
|
echo "Preparing spec file..."
|
|
cp linux-patch-api.spec ~/rpmbuild/SPECS/
|
|
|
|
# Build RPM
|
|
echo "Building RPM package..."
|
|
rpmbuild -ba ~/rpmbuild/SPECS/linux-patch-api.spec
|
|
|
|
# Copy to releases directory
|
|
echo ""
|
|
echo "Copying package to releases/..."
|
|
mkdir -p releases
|
|
cp ~/rpmbuild/RPMS/x86_64/*.rpm releases/
|
|
|
|
echo ""
|
|
echo "=== Build Complete ==="
|
|
echo "Package: releases/linux-patch-api-*.rpm"
|
|
echo ""
|
|
echo "Install with:"
|
|
echo " dnf install -y ./releases/linux-patch-api-*.rpm"
|
|
echo " # or"
|
|
echo " yum install -y ./releases/linux-patch-api-*.rpm"
|