-
Notifications
You must be signed in to change notification settings - Fork 50
143 lines (136 loc) · 4.59 KB
/
Copy pathrpm-build.yaml
File metadata and controls
143 lines (136 loc) · 4.59 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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Packaging for RPM
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
container:
image: ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
arch:
- amd64
target:
- almalinux:8.9
- almalinux:8.10
- almalinux:9.4
- almalinux:9.5
- almalinux:9.6
steps:
- name: Extract RHEL release
run: |
MINOR=$(echo "${{ matrix.target }}" | grep -oP '(?<=almalinux:[89]\.)\d+')
MAJOR=$(echo "${{ matrix.target }}" | grep -oP '(?<=almalinux:)[89]')
echo "RHEL_RELEASE=.el${MAJOR}_${MINOR}" >> $GITHUB_ENV
- name: Checkout repo
uses: actions/checkout@v4
- name: Install prereq packages
run: ./rpmpkg-setup.sh ${{ matrix.target }}
- name: Build packages
run: ./rpmpkg-build.sh
- name: Set environment variables for upload
run: echo DIRNAME=${{ matrix.target }} | tr ':' '_' >> $GITHUB_ENV
- name: Copy packages to uploadable location
run: |
mkdir -p packages/${DIRNAME}
cp ~/rpmbuild/RPMS/x86_64/*.rpm packages/${DIRNAME}/
- name: Store packages
uses: actions/upload-artifact@v4
with:
name: packages-${{ env.DIRNAME }}
path: packages/${{ env.DIRNAME }}/*.rpm
retention-days: 1
test:
runs-on: ubuntu-latest
container:
image: ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
arch:
- amd64
target:
- almalinux:8.9
- almalinux:8.10
- almalinux:9.4
- almalinux:9.5
- almalinux:9.6
needs: build
steps:
- name: Set environment variables for download
run: echo DIRNAME=${{ matrix.target }} | tr ':' '_' >> $GITHUB_ENV
- name: Extract RHEL release
run: |
MAJOR=$(echo "${{ matrix.target }}" | grep -oP '(?<=almalinux:)[89]')
echo "MAJOR=${MAJOR}" >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: packages-${{ env.DIRNAME }}
- name: Add repositories
env:
TARGET: ${{ matrix.target }}
run: |
curl -1sLf 'https://dl.cloudsmith.io/public/wand/libwandio/cfg/setup/bash.rpm.sh' | bash
curl -1sLf 'https://dl.cloudsmith.io/public/wand/libwandder/cfg/setup/bash.rpm.sh' | bash
if [[ "${MAJOR}" == "8" ]]; then
dnf config-manager --enable powertools || true
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm || true
elif [[ "${MAJOR}" == "9" ]]; then
dnf config-manager --enable crb || true
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm || true
fi
- name: Test package install
run: |
yum install -y findutils
find . -name "*.rpm" | xargs yum install -y
- name: Test package removal
run: |
rpm -e libtrace4-tools
rpm -e libpacketdump4-devel
rpm -e libtrace4-devel
rpm -e libpacketdump4
rpm -e libtrace4
publish:
runs-on: ubuntu-22.04
container:
image: ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
arch:
- amd64
target:
- almalinux:8.9
- almalinux:8.10
- almalinux:9.4
- almalinux:9.5
- almalinux:9.6
needs: test
steps:
- name: Set RHEL version number
run: |
MINOR=$(echo "${{ matrix.target }}" | grep -oP '(?<=almalinux:[89]\.)\d+')
MAJOR=$(echo "${{ matrix.target }}" | grep -oP '(?<=almalinux:)[89]')
echo "MAJOR={MAJOR}" >> $GITHUB_ENV
- name: Set environment variables for download
run: echo DIRNAME=${{ matrix.target }} | tr ':' '_' >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: packages-${{ env.DIRNAME }}
- name: Copy packages
run: |
mkdir -p packages/${DIRNAME}
yum install -y findutils
find . -name "*.rpm" | xargs cp -t packages/${DIRNAME}/
- name: Publish package to cloudsmith
uses: salcock/action-cloudsmith-upload-packages@v1.8
with:
path: packages/
repo: ${{ secrets.CLOUDSMITH_OWNER }}/libtrace
username: salcock
api_key: ${{ secrets.CLOUDSMITH_API_KEY }}