From 4846bd02939e65d653c49d10e3a704587b0e4334 Mon Sep 17 00:00:00 2001 From: Prateek Pandey Date: Wed, 2 Mar 2022 01:29:28 +0530 Subject: [PATCH] fetch tag across all branches instead of current branch (#3324) Signed-off-by: prateekpandey14 --- .github/workflows/reuse.yaml | 4 ++-- Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reuse.yaml b/.github/workflows/reuse.yaml index 091e2e74c3..2925694ee3 100644 --- a/.github/workflows/reuse.yaml +++ b/.github/workflows/reuse.yaml @@ -92,7 +92,7 @@ jobs: - name: Set Version if: ${{ inputs.tag == 'release'}} run: | - echo "KYVERNO_VERSION=$(git tag --list --sort=-version:refname "v[0-9]*" | head -n 1)" >> $GITHUB_ENV + echo "KYVERNO_VERSION=$(git describe --match "v[0-9]*" --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV - name: Generate SBOM JSON if: ${{inputs.tag == 'release'}} @@ -100,7 +100,7 @@ jobs: with: version: v1 args: app -licenses -json -output ${{inputs.image_name}}-${{ env.KYVERNO_VERSION }}-bom.cdx.json -main ${{inputs.main}} - + - name: Upload SBOM JSON if: ${{inputs.tag == 'release'}} uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1 diff --git a/Makefile b/Makefile index 5e17090297..1afc10e001 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ ################################## # DEFAULTS ################################## -GIT_VERSION := $(shell git tag --list --sort=-version:refname "v[0-9]*" | head -n 1) +GIT_VERSION := $(shell git describe --match "v[0-9]*" --tags $(git rev-list --tags --max-count=1)) GIT_VERSION_DEV := $(shell git describe --match "[0-9].[0-9]-dev*") GIT_BRANCH := $(shell git branch | grep \* | cut -d ' ' -f2) GIT_HASH := $(GIT_BRANCH)/$(shell git log -1 --pretty=format:"%H")