This repository has been archived by the owner on Jan 27, 2025. It is now read-only.
fix: use tar transform #20
Workflow file for this run
This file contains 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 and Release RPM (release branches) | |
on: | |
push: | |
branches: | |
- 'release-*' | |
jobs: | |
build_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v2 | |
- name: Determine version | |
id: determine_version | |
run: | | |
VERSION="${GITHUB_REF#refs/heads/release-}" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Build in Rocky Linux 9 Container | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/src -w /src rockylinux:9 /bin/bash -c " | |
dnf install -y rpm-build python3 python3-pip make && | |
mkdir -p /src/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} && | |
pip3 install --upgrade pip && | |
python3 -m unittest discover && | |
# Update the spec file version | |
sed -i 's/^Version:.*/Version: ${VERSION}/' md5sift.spec && | |
# Create source tarball using transform to nest files under md5sift-${VERSION}/ | |
tar czvf /src/rpmbuild/SOURCES/md5sift-${VERSION}.tar.gz \ | |
--transform 's,^,md5sift-${VERSION}/,' md5sift.py LICENSE README.md && | |
cp md5sift.spec /src/rpmbuild/SPECS/ && | |
# Build the RPM | |
rpmbuild -ba /src/rpmbuild/SPECS/md5sift.spec --define '_topdir /src/rpmbuild' && | |
# Test the RPM installation | |
rpm -ivh --nodeps /src/rpmbuild/RPMS/noarch/md5sift-${VERSION}-1.noarch.rpm && | |
md5sift --help | |
" | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ env.VERSION }}" | |
release_name: "md5sift v${{ env.VERSION }}" | |
draft: false | |
prerelease: false | |
- name: Upload RPM to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: rpmbuild/RPMS/noarch/*.rpm | |
asset_name: md5sift-${{ env.VERSION }}-1.noarch.rpm | |
asset_content_type: application/x-rpm |