-
Notifications
You must be signed in to change notification settings - Fork 5
67 lines (57 loc) · 1.87 KB
/
build-pull.yaml
File metadata and controls
67 lines (57 loc) · 1.87 KB
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
name: Build and Test for Pull Requests
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
release_tag:
description: 'Test Build the RPM in pull request.'
required: false
default: ''
permissions:
contents: write
jobs:
build-rpm:
runs-on: ubuntu-latest
container:
image: fedora:latest
env:
RELEASE_TAG: ${{ github.event.inputs.release_tag }}
steps:
- name: Install dependencies
run: |
dnf install -y \
rpm-build rpm-sign rpmlint gcc make redhat-rpm-config \
gpg gpg2 gnupg2 expect rpmdevtools createrepo
- name: Checkout repository
uses: actions/checkout@v4
- name: Get version
id: get_version
run: |
if [ -n "$RELEASE_TAG" ]; then
VERSION=${RELEASE_TAG#v}
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION=0.0.0
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "Version is ${VERSION}"
- name: Setup RPM build environment
run: |
rpmdev-setuptree
cp ./*.spec ~/rpmbuild/SPECS/
cp -r ./* ~/rpmbuild/SOURCES/ || true
- name: Create source tarball
run: |
mkdir -p ~/rpmbuild/SOURCES/openchami-${{ env.VERSION }}
cp -r ./* ~/rpmbuild/SOURCES/openchami-${{ env.VERSION }}/
tar -czf ~/rpmbuild/SOURCES/openchami-${{ env.VERSION }}.tar.gz \
-C ~/rpmbuild/SOURCES openchami-${{ env.VERSION }} \
--transform "s|openchami-${{ env.VERSION }}-${{ env.COMMIT_SHA }}|openchami-${{ env.VERSION }}|"
- name: Build RPM package
run: |
rpmbuild -ba ~/rpmbuild/SPECS/*.spec \
--define "version ${{ env.VERSION }}" \
--define "release 1"