Skip to content

Build release RPMs

Build release RPMs #14

Workflow file for this run

---
name: Build release RPMs
on:
workflow_run:
workflows: [Auto Tag]
types:
- completed
push:
tags:
- v*
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Custom tag for release, e.g. v1.2.3-1234"
required: false
default: "v0.0.0"
env:
REGISTRY_USER: ${{ github.repository_owner }}
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
setup_version:
name: "Setup Convert2RHEL version"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Determine tag
id: tag
run: |
echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
- name: Update specfile to match tag
if: startsWith(github.event.ref, 'refs/tags/')
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: startsWith(github.event.ref, 'refs/tags/')
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "convert2rhel/__init__.py"
find: "(__version__ += +).*"
replace: '${1}"${{steps.tag.outputs.tag}}"'
- name: Upload changed files
uses: actions/upload-artifact@v4
with:
name: github-repo
path: |
packaging/convert2rhel.spec
convert2rhel/__init__.py
retention-days: 1
build_rpms:
needs:
- setup_version
name: Build RPM
strategy:
fail-fast: false
matrix:
el:
- ver: 7
- ver: 8
- ver: 9
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download changed files
uses: actions/download-artifact@v4
with:
name: github-repo
- name: Login to ghcr.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}
- 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
if: ${{ github.event.release.upload_url }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .rpms/*el${{ matrix.el.ver }}*