-
Notifications
You must be signed in to change notification settings - Fork 84
105 lines (93 loc) · 2.88 KB
/
build-rpm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
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: 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 != '0.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 != '0.0.0' }}
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 }}*