Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr38 committed Jul 16, 2024
1 parent e5ef68f commit 1172fca
Showing 1 changed file with 88 additions and 48 deletions.
136 changes: 88 additions & 48 deletions .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@ on:
branches: [ main ]

jobs:
# Build rpm package for el9
build-rpm-el9:
name: Build rpm package (for el9)
#-------------------------------------------------------------------------------------------------------------------
#
# el7
#
#-------------------------------------------------------------------------------------------------------------------

# Build rpm package for el7
build-rpm-el7:
name: Build rpm package (for el7)
runs-on: ubuntu-latest
env:
# Force to use node16 (for actions/checkout@v3)
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
container:
image: rockylinux:9.3
image: centos:7
options: --user root
steps:
- name: Checkout
Expand All @@ -22,9 +32,35 @@ jobs:
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV

- name: Install CentOS7 archive repositories
run: |
rm /etc/yum.repos.d/* -f
echo "[os]
name=os repo
baseurl=https://vault.centos.org/7.9.2009/os/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/os.repo
echo "[extras]
name=extras repo
baseurl=https://vault.centos.org/7.9.2009/extras/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/extras.repo
echo "[updates]
name=updates repo
baseurl=https://vault.centos.org/7.9.2009/updates/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/updates.repo
yum clean all
- name: Install dependencies packages
run: |
yum update -y
yum install rpmdevtools rpmlint -y
- name: Create build environment
Expand Down Expand Up @@ -57,31 +93,30 @@ jobs:
run: |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/rpm/spec $HOME/rpmbuild/SPECS/linupdate.spec
sed -i "s/__VERSION__/${{ env.VERSION }}/g" $HOME/rpmbuild/SPECS/linupdate.spec
sed -i "s/__RELEASEVER__/el9/g" $HOME/rpmbuild/SPECS/linupdate.spec
sed -i "s/__RELEASEVER__/el7/g" $HOME/rpmbuild/SPECS/linupdate.spec
- name: Build package
run: |
cd $HOME/rpmbuild/SPECS
rpmbuild --target noarch -bb --quiet linupdate.spec
mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-el9.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm
mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-el7.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm
path: /tmp/linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm
name: linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm
path: /tmp/linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm
retention-days: 1

# Build rpm package for el7
build-rpm-el7:
name: Build rpm package (for el7)

# Try to install packages on latest Fedora
install-fedora:
name: Install on latest Fedora
needs:
build-rpm-el7
runs-on: ubuntu-latest
env:
# Force to use node16 (for actions/checkout@v3)
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
container:
image: centos:7
image: fedora:latest
options: --user root
steps:
- name: Checkout
Expand All @@ -90,35 +125,42 @@ jobs:
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV

- name: Install CentOS7 archive repositories
# Download builded deb package artifact
- name: Download el7 artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm

- name: Install package
run: |
rm /etc/yum.repos.d/* -f
dnf update -y
dnf clean all
dnf --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm
echo "[os]
name=os repo
baseurl=https://vault.centos.org/7.9.2009/os/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/os.repo
echo "[extras]
name=extras repo
baseurl=https://vault.centos.org/7.9.2009/extras/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/extras.repo
#-------------------------------------------------------------------------------------------------------------------
#
# el9
#
#-------------------------------------------------------------------------------------------------------------------

echo "[updates]
name=updates repo
baseurl=https://vault.centos.org/7.9.2009/updates/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/updates.repo
# Build rpm package for el9
build-rpm-el9:
name: Build rpm package (for el9)
runs-on: ubuntu-latest
container:
image: rockylinux:9.3
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3

yum clean all
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV

- name: Install dependencies packages
run: |
yum update -y
yum install rpmdevtools rpmlint -y
- name: Create build environment
Expand Down Expand Up @@ -151,23 +193,22 @@ jobs:
run: |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/rpm/spec $HOME/rpmbuild/SPECS/linupdate.spec
sed -i "s/__VERSION__/${{ env.VERSION }}/g" $HOME/rpmbuild/SPECS/linupdate.spec
sed -i "s/__RELEASEVER__/el7/g" $HOME/rpmbuild/SPECS/linupdate.spec
sed -i "s/__RELEASEVER__/el9/g" $HOME/rpmbuild/SPECS/linupdate.spec
- name: Build package
run: |
cd $HOME/rpmbuild/SPECS
rpmbuild --target noarch -bb --quiet linupdate.spec
mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-el7.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm
mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-el9.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm
path: /tmp/linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm
name: linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm
path: /tmp/linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm
retention-days: 1


# Try to install el9 package on latest Fedora
# Try to install packages on latest Fedora
install-fedora:
name: Install on latest Fedora
needs:
Expand All @@ -184,14 +225,13 @@ jobs:
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV

# Download builded deb package artifact
- name: Download artifact
- name: Download el9 artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm

- name: Install package
run: |
dnf update -y
yum clean all
yum --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm
dnf clean all
dnf --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm

0 comments on commit 1172fca

Please sign in to comment.