Files
ca-certificates-brazil/.github/workflows/build-rpm.yml
Christian Tosta 9825df6a89 Testing Workflow
2025-04-18 05:47:19 -03:00

85 lines
2.0 KiB
YAML

name: Build RPM Package
on:
push:
branches: [ workflows ]
tags: '*.*.*'
pull_request:
branches: [ workflows ]
tags: '*.*.*'
jobs:
build-rpm:
runs-on: ubuntu-latest
container:
image: fedora:latest
steps:
- name: install RPM build tools
run: |
dnf -y install \
cmake \
gcc \
gcc-c++ \
git \
rpm-build \
rpmdevtools \
tar
- name: Setup RPM build tree
run: |
rpmdev-setuptree
- name: Checkout source code
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Create source tarball
run: |
cmake -B build -S .
cmake --build build --target sdist
- name: Set environment variables
run: |
echo "PKG_NAME=ca-certificates-brazil" >> $GITHUB_ENV
echo "PKG_VERSION=$(grep \
-m1 -iPo '.*CPACK_PACKAGE_VERSION [\"]*\K[\S]*[^(\"\))]' \
build/CPackConfig.cmake) \
" >> $GITHUB_ENV
# - name: Push Git Tag
# run: |
# git config user.name "GitHub Actions"
# git config user.email "github-actions@users.noreply.github.com"
# git tag ${PKG_VERSION}
# git push origin ${PKG_VERSION}
- 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
run: |
dnf -y builddep ~/rpmbuild/SPECS/ca-certificates-brazil.spec
rpmbuild -ba ~/rpmbuild/SPECS/ca-certificates-brazil.spec
- name: Upload built RPMs
uses: actions/upload-artifact@v4
with:
name: built-rpms
path: |
~/rpmbuild/RPMS/
~/rpmbuild/SRPMS/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
draft: true
generate_release_notes: true
files: |
~/rpmbuild/RPMS/**/*.rpm