Skip to content

Add CI workflow to build RPMs #6

Add CI workflow to build RPMs

Add CI workflow to build RPMs #6

Workflow file for this run

name: Build RPM
on: push
jobs:
build-rpm:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
fail-fast: false
matrix:
os: [almalinux]
version: [8, 9]
runs-on: ubuntu-latest
container: '${{ matrix.os }}:${{ matrix.version }}'
steps:
- name: Install dependencies
run: |
dnf upgrade -y
[[ "${{ matrix.version }}" = 8 ]] && dnf module enable -y maven:3.8/common
dnf install -y git rpmdevtools rpmlint maven-openjdk11
- name: Setup build tree
run: |
mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- name: Check out repository code
uses: actions/checkout@v4
with:
path: 'rpmbuild/BUILD'
fetch-depth: 0
- name: Create .rpm
run: |
cp rpmbuild/BUILD/storm-webdav.spec rpmbuild/SPECS/storm-webdav.spec
rpmlint rpmbuild/SPECS/storm-webdav.spec
rpmbuild --define "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/storm-webdav.spec
- uses: actions/upload-artifact@v4
with:
name: build-rpm-${{ matrix.os }}-${{ matrix.version }}
path: |
rpmbuild/RPMS/noarch/*.rpm
publish-nightly:
needs: build-rpm
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
env:
NEXUS_USER: ${{ secrets.NEXUS_STORM_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_STORM_PASSWORD }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Create release
run: |
curl --user "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file build-rpm-almalinux-8/*.rpm https://repo.cloud.cnaf.infn.it/repository/storm-rpm-nightly/redhat8/
curl --user "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file build-rpm-almalinux-9/*.rpm https://repo.cloud.cnaf.infn.it/repository/storm-rpm-nightly/redhat9/
publish-beta:
needs: build-rpm
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
env:
NEXUS_USER: ${{ secrets.NEXUS_STORM_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_STORM_PASSWORD }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Create release
run: |
curl --user "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file build-rpm-almalinux-8/*.rpm https://repo.cloud.cnaf.infn.it/repository/storm-rpm-beta/redhat8/
curl --user "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file build-rpm-almalinux-9/*.rpm https://repo.cloud.cnaf.infn.it/repository/storm-rpm-beta/redhat9/
publish-stable:
needs: build-rpm
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
env:
NEXUS_USER: ${{ secrets.NEXUS_STORM_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_STORM_PASSWORD }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Create release
run: |
GITHUB_REF=${{ github.ref }}
TAG_NAME=${GITHUB_REF#refs/tags/}
if [[ ${TAG_NAME} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
curl --user "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file build-rpm-almalinux-8/*.rpm https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/redhat8/
curl --user "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file build-rpm-almalinux-9/*.rpm https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/redhat9/
fi