Files
rpmbuild/action.yaml
T

47 lines
1.6 KiB
YAML

name: "Build rpm packages"
description: "Build both src and binary rpms using rpmbuild. rpmautospec should be available on the builder image."
author: "Daniel Demus"
inputs:
specfile:
description: The filename of the spec file to build. If not set and there is only 1 specfile, it will be selected automatically.
required: false
build_arch:
description: Build architecture, default x86_64
required: false
default: x86_64
runs:
using: "composite"
steps:
- id: entrypoint
name: Clone source
shell: bash
run: |
set -e
cd ${{ gitea.workspace }}
SPECFILE=$([ "${{ inputs.specfile }}" ] && echo -n "${{ inputs.specfile }}" || echo -n $([ $(ls -1 *.spec 2>/dev/null| wc -l) -eq 1 ] && echo -n "$(ls -1 *.spec)"))
[ "$SPECFILE" == "" ] && exit 1
echo RPM autospeccing
rpmautospec process-distgit $SPECFILE $SPECFILE
echo install_weak_deps=false >> /etc/dnf/dnf.conf
microdnf builddep -y $SPECFILE
echo Checking for missing builddeps
counter=1
RPMBUILDARGS=(--target=${{ inputs.build_arch }} --define="_disable_source_fetch 0" --define "_sourcedir $PWD" --define "_topdir $PWD")
until rpmbuild "${RPMBUILDARGS[@]}" -br $SPECFILE || [ $counter -gt 5 ]; do
echo Installing missing builddeps round $counter
microdnf builddep -y SRPMS/$(rpmspec -q --srpm --qf '%{nevr}' $SPECFILE).buildreqs.nosrc.rpm
((counter++))
done
echo Building rpm and srpm
rpmbuild "${RPMBUILDARGS[@]}" -ba $SPECFILE
echo "Built $SPECFILE"
branding:
icon: "package"
color: "gray-dark"