Build release RPMs #1
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 release RPMs | |
on: | |
push: | |
tags: | |
- v* | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Custom tag for release, e.g. v1.2.3-1234" | |
required: false | |
default: "" | |
jobs: | |
setup_version: | |
name: "Setup Convert2RHEL version" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get tag | |
if: ${{ github.event_name != 'release' }} | |
id: tag | |
uses: devops-actions/[email protected] | |
with: | |
strip_v: true # Optional: Remove 'v' character from version | |
default: ${{ github.event.inputs.tag }} # Optional: Default version when tag not found | |
- name: Update specfile to match tag | |
if: ${{ github.event_name != 'release' || steps.tag.outputs.tag != '' }} | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
include: "packaging/convert2rhel.spec" | |
find: "(Version: +).*" | |
replace: "${1}${{steps.tag.outputs.tag}}" | |
- name: Update convert2rhel version to match tag | |
if: ${{ github.event_name != 'release' || steps.tag.outputs.tag != '' }} | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
include: "convert2rhel/__init__.py" | |
find: "(__version__ += +).*" | |
replace: '${1}\"${{steps.tag.outputs.tag}}\"' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: github-repo | |
path: "." | |
retention-days: 1 | |
build_rpms: | |
needs: | |
- setup_version | |
name: Build EL${{ matrix.el.ver }} RPM | |
strategy: | |
fail-fast: false | |
matrix: | |
el: | |
- ver: 7 | |
- ver: 8 | |
- ver: 9 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: github-repo | |
- name: Build RPM package for EL${{ matrix.el.ver }} | |
env: | |
BUILD_IMAGES: false # Building an image is unnecessary | |
run: | | |
make rpm${{ matrix.el.ver }} | |
- uses: shogo82148/actions-upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: .rpms/*el${{ matrix.el.ver }}* |