#name: build-rpm on: workflow_call: inputs: containers: required: true type: string version: required: false type: string to_release: required: false type: string tag: required: false type: string defaults: run: shell: bash jobs: build: strategy: max-parallel: 2 matrix: image: ${{ fromJson(inputs.containers) }} runs-on: ubuntu-latest container: ${{ matrix.image }} steps: - name: Local checkout uses: actions/checkout@v4 - name: install RPM build dependencies run: | dnf -y install \ cmake \ gcc \ gcc-c++ \ git \ rpm-build \ rpmdevtools \ tar - name: Setup RPM build tree run: | rpmdev-setuptree - name: Create source tarball run: | cmake --fresh -B build -S . cmake --build build --target sdist - name: Set environment variables run: | echo "PKG_VERSION=$(cat build/version)" >> $GITHUB_ENV echo "PKG_NAME=$(grep -Po 'Name:\ *\K[\S ]*' \ packaging/pkg.spec.in)" >> $GITHUB_ENV - name: Copy SOURCES and SPEC file run: | cp packaging/pkg.spec.in ~/rpmbuild/SPECS/${PKG_NAME}.spec rpmdev-bumpspec -n ${PKG_VERSION} ~/rpmbuild/SPECS/${PKG_NAME}.spec cp dist/*.src.tar.gz ~/rpmbuild/SOURCES/ - name: Build RPM packages run: | dnf -y builddep ~/rpmbuild/SPECS/${PKG_NAME}.spec rpmbuild -ba ~/rpmbuild/SPECS/${PKG_NAME}.spec - name: Create GitHub Release uses: softprops/action-gh-release@v2 if: inputs.to_release == 1 with: tag_name: ${{ inputs.tag }} files: | ~/rpmbuild/RPMS/*/*.rpm ~/rpmbuild/SRPMS/*.rpm