Skip to content

Commit

Permalink
chore: simplify release rpm creation (oamg#1025)
Browse files Browse the repository at this point in the history
* chore: Split RPM creation to be more granular

* chore: simplify release RPM creation
  • Loading branch information
Venefilyn authored Jan 5, 2024
1 parent 18add35 commit 4563bdc
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 132 deletions.
139 changes: 13 additions & 126 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,138 +6,25 @@ on:
types: [published]

jobs:
build_el7_rpm:
name: Build EL7 RPM
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4 # v4

### start manpage generation
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.10.13

- name: Install dependencies
run: |
pip install argparse-manpage six pexpect
- name: Install python3-rpm and python3-dnf package with apt-get
run: |
sudo apt-get update
sudo apt-get install -y python3-rpm python3-dnf
- name: Generate Manpages
run: |
chmod +x scripts/manpage_generation.sh
bash scripts/manpage_generation.sh
### end manpage generation

- name: Build RPM package for EL7
id: rpm_build_el7
uses: oamg/rpmbuild@el7
with:
spec_path: "packaging/convert2rhel.spec"

- name: Upload EL7 RPM as release asset
id: upload_release_asset_el7
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.rpm_build_el7.outputs.rpm_path }}
asset_name: ${{ steps.rpm_build_el7.outputs.rpm_name }}
asset_content_type: ${{ steps.rpm_build_el7.outputs.content_type }}

build_el8_rpm:
name: Build EL8 RPM
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

### start manpage generation
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.10.13

- name: Install dependencies
run: |
pip install argparse-manpage six pexpect
- name: Install python3-rpm and python3-dnf package with apt-get
run: |
sudo apt-get update
sudo apt-get install -y python3-rpm python3-dnf
- name: Generate Manpages
run: |
chmod +x scripts/manpage_generation.sh
bash scripts/manpage_generation.sh
### end manpage generation

- name: Build RPM package for EL8
id: rpm_build_el8
uses: oamg/rpmbuild@el8
with:
spec_path: "packaging/convert2rhel.spec"

- name: Upload EL8 RPM as release asset
id: upload_release_asset_el8
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.rpm_build_el8.outputs.rpm_path }}
asset_name: ${{ steps.rpm_build_el8.outputs.rpm_name }}
asset_content_type: ${{ steps.rpm_build_el8.outputs.content_type }}

build_el9_rpm:
if: false
name: Build EL9 RPM
build_rpms:
name: Build EL${{ matrix.el.ver }} 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

### start manpage generation
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.10.13

- name: Install dependencies
run: |
pip install argparse-manpage six pexpect
- name: Install python3-rpm and python3-dnf package with apt-get
run: |
sudo apt-get update
sudo apt-get install -y python3-rpm python3-dnf
- name: Generate Manpages
- name: Build RPM package for EL${{ matrix.el.ver }}
run: |
chmod +x scripts/manpage_generation.sh
bash scripts/manpage_generation.sh
### end manpage generation

- name: Build RPM package for EL9
id: rpm_build_el9
uses: oamg/rpmbuild@el9
with:
spec_path: "packaging/convert2rhel.spec"
make rpm${{ matrix.el.ver }}
- name: Upload EL9 RPM as release asset
id: upload_release_asset_el9
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.rpm_build_el9.outputs.rpm_path }}
asset_name: ${{ steps.rpm_build_el9.outputs.rpm_name }}
asset_content_type: ${{ steps.rpm_build_el9.outputs.content_type }}
asset_path: .rpms/*el${{ matrix.el.ver }}*
29 changes: 23 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
lint \
lint-errors \
rpms \
rpm7 \
rpm8 \
rpm9 \

# Project constants
IMAGE_REPOSITORY ?= ghcr.io
Expand Down Expand Up @@ -140,16 +143,30 @@ tests9: image9
@echo 'CentOS 9 tests'
@$(call CONTAINER_TEST_FUNC,centos9,--show-capture=$(SHOW_CAPTURE))

rpms:
mkdir -p .rpms
rm -frv .rpms/*
$(PODMAN) build -f Containerfiles/rpmbuild.centos9.Containerfile -t $(IMAGE_ORG)/$(IMAGE_PREFIX)-centos9rpmbuild .
$(PODMAN) build -f Containerfiles/rpmbuild.centos8.Containerfile -t $(IMAGE_ORG)/$(IMAGE_PREFIX)-centos8rpmbuild .

.rpm7:
rm -frv .rpms/*el7*
$(PODMAN) build -f Containerfiles/rpmbuild.centos7.Containerfile -t $(IMAGE_ORG)/$(IMAGE_PREFIX)-centos7rpmbuild .
$(PODMAN) cp $$($(PODMAN) create $(IMAGE_ORG)/$(IMAGE_PREFIX)-centos8rpmbuild):/data/.rpms .
$(PODMAN) cp $$($(PODMAN) create $(IMAGE_ORG)/$(IMAGE_PREFIX)-centos7rpmbuild):/data/.rpms .

.rpm8:
rm -frv .rpms/*el8*
$(PODMAN) build -f Containerfiles/rpmbuild.centos8.Containerfile -t $(IMAGE_ORG)/$(IMAGE_PREFIX)-centos8rpmbuild .
$(PODMAN) cp $$($(PODMAN) create $(IMAGE_ORG)/$(IMAGE_PREFIX)-centos8rpmbuild):/data/.rpms .

.rpm9:
rm -frv .rpms/*el9*
$(PODMAN) build -f Containerfiles/rpmbuild.centos9.Containerfile -t $(IMAGE_ORG)/$(IMAGE_PREFIX)-centos9rpmbuild .
$(PODMAN) cp $$($(PODMAN) create $(IMAGE_ORG)/$(IMAGE_PREFIX)-centos9rpmbuild):/data/.rpms .

.rpm-container-cleanup:
$(PODMAN) rm $$($(PODMAN) ps -aq) -f

rpms: .rpm7 .rpm8 .rpm9 .rpm-container-cleanup
rpm7: .rpm7 .rpm-container-cleanup
rpm8: .rpm8 .rpm-container-cleanup
rpm9: .rpm9 .rpm-container-cleanup

copr-build: rpms
mkdir -p .srpms
rm -frv .srpms/*
Expand Down

0 comments on commit 4563bdc

Please sign in to comment.