79 lines
2.6 KiB
YAML
79 lines
2.6 KiB
YAML
name: Flatpost RPM Build - Fedora/Nobara 41
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
version:
|
|
required: false
|
|
type: string
|
|
shasum:
|
|
required: false
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: fedora:41
|
|
|
|
steps:
|
|
- name: Install Git
|
|
run: dnf install -y git
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Configure Git safe directory
|
|
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
|
|
- name: Install build dependencies
|
|
run: dnf install -y git rpm-build make python3-devel python3-build
|
|
|
|
- name: Extract Version and SHA
|
|
run: |
|
|
# Get version from git tags (assuming semantic versioning format)
|
|
VERSION=$(git describe --tags --abbrev=0 || echo "unknown")
|
|
echo $VERSION
|
|
|
|
# Get current commit SHA
|
|
COMMIT_SHA=$(git rev-parse HEAD)
|
|
echo $COMMIT_SHA
|
|
|
|
# Store values in environment file
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
|
|
|
|
- name: Build the project
|
|
run: |
|
|
# Use either provided input or extracted value
|
|
git submodule update --init --recursive
|
|
|
|
cd ..
|
|
mkdir -p ~/rpmbuild/SOURCES/
|
|
cp -R flatpost flatpost-${{ env.VERSION }}/
|
|
tar -cvzf flatpost-${{ env.VERSION }}.tar.gz flatpost-${{ env.VERSION }}
|
|
mv flatpost-${{ env.VERSION }}.tar.gz ~/rpmbuild/SOURCES/
|
|
rm -Rf flatpost-${{ env.VERSION }}/
|
|
cd flatpost/
|
|
|
|
sed -i "s|^%global tag .*|%global tag ${{ env.VERSION }}|g" packaging/rpm/flatpost.spec
|
|
cat packaging/rpm/flatpost.spec | grep tag
|
|
|
|
sed -i "s|^%global commit .*|%global commit ${{ env.COMMIT_SHA }}|g" packaging/rpm/flatpost.spec
|
|
cat packaging/rpm/flatpost.spec | grep commit
|
|
|
|
rpmbuild -ba packaging/rpm/flatpost.spec
|
|
mv ~/rpmbuild/RPMS/noarch/flatpost-${{ env.VERSION }}*.rpm \
|
|
~/rpmbuild/RPMS/noarch/flatpost-${{ env.VERSION }}.fc41.rpm
|
|
mv ~/rpmbuild/SRPMS/noarch/flatpost-${{ env.VERSION }}*.rpm \
|
|
~/rpmbuild/RPMS/noarch/flatpost-${{ env.VERSION }}.fc41.src.rpm
|
|
|
|
- name: Fedora-41
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: flatpost-${{ env.VERSION }}.fc41.rpm
|
|
path: ~/rpmbuild/RPMS/noarch/flatpost-${{ env.VERSION }}.fc41.rpm
|
|
name: flatpost-${{ env.VERSION }}.fc41.src.rpm
|
|
path: ~/rpmbuild/RPMS/noarch/flatpost-${{ env.VERSION }}.fc41.src.rpm
|