Agnostic profile controls readme generation #2013
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 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 |