- Notifications
You must be signed in to change notification settings - Fork47
A GitHub Action to build RPMs from source code and spec file, uses rpmbuild .
License
naveenrajm7/rpmbuild
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This GitHub Action builds RPMs from spec file and using repository contents as source (wraps the rpmbuild utility).Integrates easily with GitHub actions to allow RPMS to be uploaded as Artifact (actions/upload-artifact) or as Release Asset (actions/upload-release-asset).
Create a workflow.yml
file in your repositories.github/workflows
directory. Anexample workflow is available below. For more information, reference the GitHub Help Documentation forCreating a workflow file.
Note: You need to have a spec file in order to build RPM.
spec_file
: The path to the spec file in your repo. [required]additional_repos
: A list of additional repositories (in JSON-array format) that you want enabled to build your rpm. [optional]
rpm_dir_path
: path to RPMS directorysource_rpm_path
: path to Source RPM filesource_rpm_dir_path
: path to SRPMS directorysource_rpm_name
: name of Source RPM filerpm_content_type
: Content-type for RPM Upload
This generated RPMS and SRPMS can be used in two ways.
- Upload as build artifactYou can use GitHub Action
@actions/upload-artifact
- Upload as Release assestIf you want to upload as release asset ,You also will need to have a release to upload your asset to, which could be created programmatically by
@actions/create-release
as show in the example workflow.
Basic:
name:RPM Buildon:pushjobs:build:runs-on:ubuntu-lateststeps: -uses:actions/checkout@v2 -name:build RPM packageid:rpmuses:naveenrajm7/rpmbuild@masterwith:spec_file:"cello.spec"additional_repos:"['centos-release-scl', 'http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm']" -name:Upload artifactuses:actions/upload-artifact@v1.0.0with:name:Binary RPMpath:${{ steps.rpm.outputs.rpm_dir_path }}
This workflow triggered on everypush
, builds RPM and Source RPM using cello.spec and contents of that git ref that triggered that action. Contents are retrived throughGitHub API [downloaded through archive link].
The generated RPMs or SRPMS can be uploaded as artifacts by using actions/upload-artifact. Theoutputs given by rpmbuild action can be used to specify path for upload action.
Use with Release:
on:push:# Sequence of patterns matched against refs/tagstags: -'v*'# Push events to matching v*, i.e. v1.0, v20.15.10name:Create RPM Releasejobs:build:name:Create RPM Releaseruns-on:ubuntu-lateststeps: -name:Checkout codeuses:actions/checkout@master -name:Create Releaseid:create_releaseuses:actions/create-release@latestenv:GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}# This token is provided by Actions, you do not need to create your own tokenwith:tag_name:${{ github.ref }}release_name:Release ${{ github.ref }}body:| Changes in this Release - Create RPM - Upload Source RPMdraft:falseprerelease:false -name:build RPM packageid:rpm_builduses:naveenrajm7/rpmbuild@masterwith:spec_file:"cello.spec" -name:Upload Release Assetid:upload-release-assetuses:actions/upload-release-asset@v1env:GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}with:upload_url:${{ steps.create_release.outputs.upload_url }}# This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-stepsasset_path:${{ steps.rpm_build.outputs.source_rpm_path }}asset_name:${{ steps.rpm_build.outputs.source_rpm_name }}asset_content_type:${{ steps.rpm_build.outputs.rpm_content_type }}
Example Repository which uses rpmbuild actionhttps://github.com/naveenrajm7/cello
Note on distribution:If your RPMs are distribution specific like el7 or el8.
- Use naveenrajm7/rpmbuild@master for Centos7[el7]
- Use naveenrajm7/rpmbuild@centos8 for Centos8[el8]
-name:build RPM packageid:rpm_builduses:naveenrajm7/rpmbuild@centos8with:spec_file:"cello.spec"
Feel free to contribute to this project. ReadCONTRIBUTING Guide for more details.
The scripts and documentation in this project are released under theGNU GPLv3
Created during the GitHub Actions Hackathon 2020 💻 .
Made it to thewinner's list (See Row no. 291!) 🏆 🏅
About
A GitHub Action to build RPMs from source code and spec file, uses rpmbuild .