From 44090a598402bfdbe4e616b43bdd6d95ded35be2 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Sun, 8 Oct 2023 01:35:22 -0600 Subject: [PATCH] Reflow release.yml Signed-off-by: Jonathon Anderson --- .github/workflows/release.yml | 140 +++++++++++++++++----------------- 1 file changed, 71 insertions(+), 69 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 282a4143..e66f8814 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,7 @@ jobs: dist: name: Checkout code and build warewulf.spec and dist runs-on: ubuntu-latest + steps: - name: Set DIST run: | @@ -43,81 +44,82 @@ jobs: file: ${{ env.DIST }} rpm: - name: Build RPMs - needs: dist - runs-on: ubuntu-latest - container: - image: rockylinux/rockylinux:9 - options: --privileged - strategy: - fail-fast: false - matrix: - include: - - target: rocky+epel-8-x86_64 - arch: x86_64 - dist: el8 - - target: rocky+epel-9-x86_64 - arch: x86_64 - dist: el9 - - target: centos+epel-7-x86_64 - arch: x86_64 - dist: el7 - - target: opensuse-leap-15.5-x86_64 - arch: x86_64 - dist: suse.lp155 - steps: - - name: Install EPEL - run: dnf -y install epel-release + name: Build RPMs + needs: dist + runs-on: ubuntu-latest + container: + image: rockylinux/rockylinux:9 + options: --privileged + strategy: + fail-fast: false + matrix: + include: + - target: rocky+epel-8-x86_64 + arch: x86_64 + dist: el8 + - target: rocky+epel-9-x86_64 + arch: x86_64 + dist: el9 + - target: centos+epel-7-x86_64 + arch: x86_64 + dist: el7 + - target: opensuse-leap-15.5-x86_64 + arch: x86_64 + dist: suse.lp155 - - name: Install mock and rpm-build - run: | - dnf -y install mock rpm-build - echo "config_opts['print_main_output'] = True" >>/etc/mock/site-defaults.cfg + steps: + - name: Install EPEL + run: dnf -y install epel-release - - name: Download spec - uses: actions/download-artifact@v3 - with: - name: warewulf.spec + - name: Install mock and rpm-build + run: | + dnf -y install mock rpm-build + echo "config_opts['print_main_output'] = True" >>/etc/mock/site-defaults.cfg - - name: Set the expected version - run: | - echo "EXPECTED_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + - name: Download spec + uses: actions/download-artifact@v3 + with: + name: warewulf.spec - - name: Download dist - uses: actions/download-artifact@v3 - with: - name: warewulf-${{ env.EXPECTED_VERSION }}.tar.gz + - name: Set the expected version + run: | + echo "EXPECTED_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - - name: Set RPM and SRPM - run: | - VERSION=$(rpm -q --qf "%{VERSION}\n" --specfile warewulf.spec) - GENERIC_RELEASE=$(rpm -q --qf "%{RELEASE}\n" --specfile warewulf.spec | cut -d. -f1-2) - RPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ matrix.dist }}.${{ matrix.arch }}.rpm - SRPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ matrix.dist }}.src.rpm - echo "RPM=${RPM}" >> $GITHUB_ENV - echo "SRPM=${SRPM}" >> $GITHUB_ENV + - name: Download dist + uses: actions/download-artifact@v3 + with: + name: warewulf-${{ env.EXPECTED_VERSION }}.tar.gz - - name: Build RPMs and run tests - run: | - mock -r ${{ matrix.target }} --rebuild --spec=warewulf.spec --sources=. - mock -r ${{ matrix.target }} --chroot -- make -C /builddir/build/BUILD/warewulf-${{ env.EXPECTED_VERSION }} test + - name: Set RPM and SRPM + run: | + VERSION=$(rpm -q --qf "%{VERSION}\n" --specfile warewulf.spec) + GENERIC_RELEASE=$(rpm -q --qf "%{RELEASE}\n" --specfile warewulf.spec | cut -d. -f1-2) + RPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ matrix.dist }}.${{ matrix.arch }}.rpm + SRPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ matrix.dist }}.src.rpm + echo "RPM=${RPM}" >> $GITHUB_ENV + echo "SRPM=${SRPM}" >> $GITHUB_ENV - - name: Upload RPM - uses: actions/upload-artifact@v3 - with: - name: ${{ env.RPM }} - path: /var/lib/mock/${{ matrix.target }}/result/${{ env.RPM }} + - name: Build RPMs and run tests + run: | + mock -r ${{ matrix.target }} --rebuild --spec=warewulf.spec --sources=. + mock -r ${{ matrix.target }} --chroot -- make -C /builddir/build/BUILD/warewulf-${{ env.EXPECTED_VERSION }} test - - name: Upload SRPM - uses: actions/upload-artifact@v3 - with: - name: ${{ env.SRPM }} - path: /var/lib/mock/${{ matrix.target }}/result/${{ env.SRPM }} + - name: Upload RPM + uses: actions/upload-artifact@v3 + with: + name: ${{ env.RPM }} + path: /var/lib/mock/${{ matrix.target }}/result/${{ env.RPM }} - - name: Attach RPM and SRPM to release - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - release_id: ${{ github.event.release.id }} - file: "/var/lib/mock/${{ matrix.target }}/result/${{ env.RPM }};/var/lib/mock/${{ matrix.target }}/result/${{ env.SRPM }}" + - name: Upload SRPM + uses: actions/upload-artifact@v3 + with: + name: ${{ env.SRPM }} + path: /var/lib/mock/${{ matrix.target }}/result/${{ env.SRPM }} + + - name: Attach RPM and SRPM to release + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ github.event.release.id }} + file: "/var/lib/mock/${{ matrix.target }}/result/${{ env.RPM }};/var/lib/mock/${{ matrix.target }}/result/${{ env.SRPM }}"