Build release RPMs #8
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 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: "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: Display downloaded files | |
run: ls -la | |
- 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 != 'v0.0.0' }} | |
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 != 'v0.0.0' }} | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
include: "convert2rhel/__init__.py" | |
find: "(__version__ += +).*" | |
replace: '${1}"${{steps.tag.outputs.tag}}"' | |
- name: Upload tar file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: github-repo | |
path: | | |
packaging/convert2rhel.spec | |
convert2rhel/__init__.py | |
retention-days: 1 | |
include-hidden-files: true | |
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: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: github-repo | |
- name: Display downloaded files | |
run: ls -la | |
- 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 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: .rpms/*el${{ matrix.el.ver }}* |