-
Notifications
You must be signed in to change notification settings - Fork 37
65 lines (55 loc) · 1.85 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
name: Build SAF-CLI RPM Installers
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build-deploy:
runs-on: ubuntu-22.04
container:
image: registry.access.redhat.com/ubi8/nodejs-18:latest
options: -u 0 # dnf needs root
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
path: saf
- name: setup node
uses: actions/setup-node@v4
with:
node-version: "18"
check-latest: true
cache: 'npm'
cache-dependency-path: ./saf/package-lock.json
- name: install build dependencies
run: dnf install -y rpm-build perl-Digest-SHA # rpmbuild, shasum
- name: setup saf cli
working-directory: ./saf
run: |
rm -rf test
npm ci
- name: set filename envvar
working-directory: ./saf
run: |
echo "filename=saf-v$(cat VERSION)-linux-x64" >> "$GITHUB_ENV"
- name: pack into tarball # we are targetting x86-64 since oclif bundles a node binary, but the project is actually fully architecture independent so long as they have a node binary on it
working-directory: ./saf
run: npx oclif pack tarballs -t linux-x64 --no-xz
- name: repack tarball but include the spec file
working-directory: ./saf/dist
run: |
gzip -dc "$(ls)" > "$filename.tar"
tar -rf "$filename.tar" --transform 's|^\.\.|saf|' ../saf.spec
gzip "$filename.tar"
- name: build rpm
working-directory: ./saf
run: rpmbuild -ta "dist/$filename.tar.gz" -D "_rpmdir $(pwd)" -D "version $(cat VERSION)"
- name: upload binary as artifact
uses: actions/upload-artifact@v4
with:
name: SAF-CLI RPM Build noarch
path: saf/noarch/saf-*.rpm