A reusable GitHub Action to download and install an RPM package from a GitHub release, with automatic RHEL version detection.
- 🎯 Auto-detection - Automatically detects your system's RHEL version (8, 9, or 10)
- 🔍 Smart matching - Finds the correct RPM for your system from release assets
- 📦 One-liner integration - Easy to use in your GitHub Actions workflows
- 🛡️ Secure - Uses GitHub tokens for secure API access
- 📊 Output information - Returns the downloaded filename and URL for further use
Use this action in your GitHub Actions workflow:
name: Install Package
on: [push, pull_request]
jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Install RPM from Release
uses: NSLS2/install-rpm-from-gh-release@v1
with:
repository: 'owner/package-repo'
release_tag: 'v1.0.0'`- name: Install specific version
uses: NSLS2/install-rpm-from-gh-release@v1
with:
repository: 'orgs/my-package'
release_tag: 'v2.3.1'
rhel_version: '9'- name: Install RPM
id: install
uses: NSLS2/install-rpm-from-gh-release@v1
with:
repository: 'owner/package'
release_tag: 'v1.0.0'
- name: Log Results
run: |
echo "Installed: ${{ steps.install.outputs.rpm_filename }}"
echo "From: ${{ steps.install.outputs.rpm_url }}"
echo "Detected RHEL: ${{ steps.install.outputs.detected_rhel_version }}"To also install the -devel package variant (useful for building against the installed package):
- name: Install Package and Devel Variant
uses: NSLS2/install-rpm-from-gh-release@v1
with:
repository: 'owner/package'
release_tag: 'v1.0.0'
install_devel: 'true'| Input | Required | Default | Description |
|---|---|---|---|
repository |
✓ | - | Target repository in owner/repo format |
release_tag |
✓ | - | Release tag to download from (e.g., v1.0.0) |
rhel_version |
✗ | Auto-detect | RHEL version (8, 9, or 10). If empty, auto-detects. |
github_token |
✗ | ${{ github.token }} |
GitHub token for API access |
install_devel |
✗ | 'false' |
Also install the -devel package variant if available |
| Output | Description |
|---|---|
rpm_filename |
The filename of the downloaded RPM |
rpm_url |
The download URL of the RPM |
devel_rpm_filename |
The filename of the downloaded -devel RPM (if install_devel: 'true') |
devel_rpm_url |
The download URL of the -devel RPM (if install_devel: 'true') |
detected_rhel_version |
The RHEL version used for matching |
- Version Detection - Detects the system's RHEL version or uses the provided
rhel_version - Release Fetch - Queries the GitHub API to get release information
- RPM Matching - Searches release assets for an RPM matching the detected/specified RHEL version
- Devel Package Search (optional) - If
install_devel: 'true', searches for a matching-develvariant package - Download - Downloads the matched RPM(s)
- Installation - Installs the RPM(s) using
dnf
The action recognizes RPMs with these naming patterns:
package-1.0-1.el8.x86_64.rpmpackage-1.0-1.rhel-8.x86_64.rpmpackage-1.0-1.fc8.x86_64.rpmpackage-1.0.el8.x86_64.rpm- And other variations with
el{version},rhel-{version}, orfc{version}
- A GitHub Actions runner with a RHEL-like OS installed (RHEL, AlmaLinux, Rocky Linux, CentOS) version 8, 9, or 10
curlandjqinstalled and in thePATH(the action checks for these tools and will fail if they are missing)
Here's a complete workflow example:
name: Build and Install
on:
workflow_dispatch:
inputs:
repo:
description: 'Repository to install from'
required: true
tag:
description: 'Release tag'
required: true
jobs:
install-rpm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Package
uses: NSLS2/install-rpm-from-gh-release@v1
with:
repository: ${{ github.event.inputs.repo }}
release_tag: ${{ github.event.inputs.tag }}
- name: Verify Installation
run: |
# Replace 'package-name' with your actual package command
package-name --versionThe action couldn't find an RPM matching your RHEL version in the release. Check that:
- The release tag exists
- The repository contains RPM assets
- The RPM filename contains an RHEL version identifier (e.g.,
.el8,rhel-9) - You're specifying the correct
rhel_versionif not using auto-detection
This often means:
- The repository doesn't exist or is private (use a valid token)
- The release tag doesn't exist
- GitHub API rate limits are exceeded
Ensure your github_token has appropriate permissions.
BSD 3-Clause License - See LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.
For issues, questions, or suggestions, please open an issue in the repository.