Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
name: Build RPM and add them to a release
on: [push, pull_request]
jobs:
pytest:
runs-on: ubuntu-20.04
strategy:
matrix:
python: ["3.6", "3.7", "3.8", "3.9"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}
architecture: x64
- name: Install Python packages
run: |
pip install pytest pytest-mock requests
- name: Run tests
run: pytest -v $PWD/test
build-rpms:
needs: [pytest]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Get tag or commit id
id: get-version-id
uses: iawia002/get-tag-or-commit-id@v1
with:
length: 7
- name: create tarball
shell: bash
run: |
version=$(echo ${{ steps.get-version-id.outputs.id }} | tr -d 'v')
mkdir SOURCES
mkdir SPECS
cat hb-jobinfo.spec | sed s/HB_JOBINFO_VERSION/$version/ > SPECS/hb-jobinfo.spec
mkdir hb-jobinfo-${version}
cp jobinfo hb-jobinfo-${version}
tar -czf SOURCES/hb-jobinfo-${version}.tar.gz hb-jobinfo-${version}
- name: rpmbuild rockylinux8
uses: ./.github/actions/rpmbuild-rockylinux8/
- name: rpmbuild rockylinux9
uses: ./.github/actions/rpmbuild-rockylinux9/
- name: upload rpm package as artifact
uses: actions/upload-artifact@v4
with:
name: RPM package
path: ${{ github.workspace }}/noarch/hb-jobinfo*.rpm
create-release:
needs: [build-rpms]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: checkout
uses: actions/checkout@v4
- name: find release version in tag
id: find_version
run: |
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
- name: download RPM packages
uses: actions/download-artifact@v4
with:
name: RPM package
path: ./build_artifacts
- name: find filenames of downloaded packages
id: find_filenames
shell: bash
run: |
ls -1 -R .
echo ::set-output name=package_filenames::$(find ./build_artifacts -name hb-jobinfo*.rpm)
- uses: meeDamian/github-release@2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.find_version.outputs.version }}
name: hb-jobinfo ${{ steps.find_version.outputs.version }}
body: >
hb-jobinfo release ${{ steps.find_version.outputs.version }}
files: ${{ steps.find_filenames.outputs.package_filenames }}
gzip: false
allow_override: true