diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e0f9223d..f9fdd33d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -21,7 +21,7 @@ jobs: go-version: ['1.18', '1.19', '1.20'] steps: - name: Checkout Warewulf - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: ./.github/actions/prepare with: go-version: ${{ matrix.go-version }} @@ -35,7 +35,7 @@ jobs: go-version: ['1.18', '1.19', '1.20'] steps: - name: Checkout Warewulf - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: ./.github/actions/prepare with: go-version: ${{ matrix.go-version }} @@ -49,7 +49,7 @@ jobs: go-version: ['1.18', '1.19', '1.20'] steps: - name: Checkout Warewulf - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: ./.github/actions/prepare with: go-version: ${{ matrix.go-version }} @@ -63,7 +63,7 @@ jobs: go-version: ['1.18', '1.19', '1.20'] steps: - name: Checkout Warewulf - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: ./.github/actions/prepare with: go-version: ${{ matrix.go-version }} @@ -77,7 +77,7 @@ jobs: go-version: ['1.18', '1.19', '1.20'] steps: - name: Checkout Warewulf - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: ./.github/actions/prepare with: go-version: ${{ matrix.go-version }} diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e1b8d6d1..ece9ea06 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -20,7 +20,7 @@ jobs: if: ${{ github.repository_owner == 'warewulf' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly-release.yml similarity index 96% rename from .github/workflows/nightly.yml rename to .github/workflows/nightly-release.yml index f9739565..c1cd3d2c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly-release.yml @@ -17,7 +17,7 @@ jobs: permissions: write-all # might not be used for realy deployment steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: 'main' - uses: ./.github/actions/generate @@ -56,7 +56,7 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: 'main' - uses: ./.github/actions/rpm diff --git a/.github/workflows/release.yml b/.github/workflows/tagged-release.yml similarity index 63% rename from .github/workflows/release.yml rename to .github/workflows/tagged-release.yml index e66f8814..a05b5ad5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/tagged-release.yml @@ -1,10 +1,10 @@ --- -name: release +name: tagged-release on: - release: - types: - - published + push: + tags: + - 'v*.*.*' jobs: dist: @@ -17,31 +17,28 @@ jobs: echo "DIST=warewulf-${GITHUB_REF#refs/tags/v}.tar.gz" >> $GITHUB_ENV - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build spec and dist run: | make warewulf.spec dist - - name: Upload warewulf.spec - uses: actions/upload-artifact@v3 + - name: Upload spec and dist + uses: actions/upload-artifact@v4 with: - name: warewulf.spec - path: warewulf.spec + name: spec-and-dist + path: | + warewulf.spec + ${{ env.DIST }} - - name: Upload DIST - uses: actions/upload-artifact@v3 - with: - name: ${{ env.DIST }} - path: ${{ env.DIST }} - - - name: Attach DIST to release + - name: Attach dist to release uses: xresloader/upload-to-github-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - release_id: ${{ github.event.release.id }} file: ${{ env.DIST }} + tags: true + draft: true rpm: name: Build RPMs @@ -68,34 +65,25 @@ jobs: dist: suse.lp155 steps: - - name: Install EPEL - run: dnf -y install epel-release - - - name: Install mock and rpm-build + - name: Prepare mock and rpm-build run: | + dnf -y install epel-release dnf -y install mock rpm-build echo "config_opts['print_main_output'] = True" >>/etc/mock/site-defaults.cfg - - name: Download spec - uses: actions/download-artifact@v3 + - name: Download dist and spec + uses: actions/download-artifact@v4 with: - name: warewulf.spec + name: spec-and-dist - - name: Set the expected version - run: | - echo "EXPECTED_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - - - name: Download dist - uses: actions/download-artifact@v3 - with: - name: warewulf-${{ env.EXPECTED_VERSION }}.tar.gz - - - name: Set RPM and SRPM + - name: Configure the environment run: | VERSION=$(rpm -q --qf "%{VERSION}\n" --specfile warewulf.spec) - GENERIC_RELEASE=$(rpm -q --qf "%{RELEASE}\n" --specfile warewulf.spec | cut -d. -f1-2) + GENERIC_RELEASE=$(rpm -q --qf "%{RELEASE}\n" --specfile warewulf.spec | sed 's/\.[^.]*$//') RPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ matrix.dist }}.${{ matrix.arch }}.rpm SRPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ matrix.dist }}.src.rpm + + echo "EXPECTED_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV echo "RPM=${RPM}" >> $GITHUB_ENV echo "SRPM=${SRPM}" >> $GITHUB_ENV @@ -104,22 +92,11 @@ jobs: 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 RPM - uses: actions/upload-artifact@v3 - with: - name: ${{ env.RPM }} - path: /var/lib/mock/${{ matrix.target }}/result/${{ env.RPM }} - - - 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 }}" + tags: true + draft: true diff --git a/Variables.mk b/Variables.mk index ceb476b3..bc5cb0bb 100644 --- a/Variables.mk +++ b/Variables.mk @@ -13,18 +13,17 @@ VARLIST := OS # Project Information VARLIST += WAREWULF VERSION RELEASE WAREWULF ?= warewulf -VERSION ?= 4.5.0-rc1 +VERSION ?= 4.5.0rc1 +RELEASE_INCREMENT ?= 1 -GIT_TAG := $(shell test -e .git && git log -1 --format="%h") - -ifdef GIT_TAG - ifdef $(filter $(OS),ubuntu debian) - RELEASE ?= 1.git_$(subst -,+,$(GIT_TAG)) - else - RELEASE ?= 1.git_$(subst -,_,$(GIT_TAG)) - endif +GIT_HASH := $(shell test -e .git && git log -1 --format="%h") +GIT_TAG := $(shell test -e .git && git describe --tags | head -n1) +ifeq ($(GIT_TAG),v$(VERSION)) + RELEASE ?= $(RELEASE_INCREMENT) +else ifdef GIT_HASH + RELEASE ?= $(RELEASE_INCREMENT).git_$(GIT_HASH) else - RELEASE ?= 1 + RELEASE ?= $(RELEASE_INCREMENT) endif # Use LSB-compliant paths if OS is known