Build RPM Package #77
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build RPM Package | |
on: | |
push: | |
tags: [ 'v*' ] | |
workflow_dispatch: | |
jobs: | |
build-rpm: | |
runs-on: ubuntu-latest | |
container: | |
image: fedora:latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install build dependencies | |
run: | | |
dnf install -y \ | |
rpm-build \ | |
rpm-devel \ | |
rpmlint \ | |
python3-devel \ | |
python3-setuptools \ | |
python3-qt5 \ | |
python3-qt5-webengine \ | |
python3-feedparser \ | |
python3-pyspellchecker \ | |
python3-enchant \ | |
rpmdevtools \ | |
gcc \ | |
make | |
- name: Set up RPM build environment | |
run: | | |
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | |
cp rpm.spec ~/rpmbuild/SPECS/ | |
- name: Get version from spec | |
id: get_version | |
run: | | |
VERSION=$(grep "Version:" rpm.spec | awk '{print $2}') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Create source tarball | |
run: | | |
mkdir -p /tmp/jottr-${{ steps.get_version.outputs.version }} | |
cp -r src LICENSE README.md icons /tmp/jottr-${{ steps.get_version.outputs.version }}/ | |
cd /tmp | |
tar czf ~/rpmbuild/SOURCES/jottr-${{ steps.get_version.outputs.version }}.tar.gz jottr-${{ steps.get_version.outputs.version }}/ | |
- name: Build RPM package | |
run: | | |
cd ~/rpmbuild/SPECS | |
rpmbuild -ba rpm.spec | |
- name: Run rpmlint | |
run: | | |
rpmlint ~/rpmbuild/RPMS/noarch/jottr-*.rpm | |
- name: Test RPM installation | |
run: | | |
dnf install -y ~/rpmbuild/RPMS/noarch/jottr-*.rpm | |
- name: Upload RPM artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rpm-packages | |
path: | | |
~/rpmbuild/RPMS/noarch/jottr-*.rpm | |
~/rpmbuild/SRPMS/jottr-*.rpm | |
- name: Create Release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
~/rpmbuild/RPMS/noarch/jottr-*.rpm | |
~/rpmbuild/SRPMS/jottr-*.rpm | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |