From a9be690dc94ed47a807102dbbdaa0e8603849187 Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Mon, 2 Dec 2024 20:46:45 -0800 Subject: [PATCH] ci: Release action error fix --- .github/workflows/release.yml | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 841a2e640687..3329912ab4d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,7 @@ on: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+[0-9a-z]+' workflow_dispatch: + inputs: create_release: description: Create a draft release default: no @@ -15,6 +16,14 @@ on: options: - yes - no + ref_type: + description: 'Ref type (tag or branch)' + required: true + default: 'tag' + ref_name: + description: 'Ref name (e.g., v24.11 or master)' + required: true + default: 'v24.11' jobs: check: @@ -26,16 +35,21 @@ jobs: - name: Git checkout uses: actions/checkout@v4 with: + fetch-depth: 0 fetch-tags: true - - name: Determine version from pushed tag - if: ${{ github.ref_type == 'tag' }} - run: echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV" - - # Relevant for testing branches. - - name: Determine version from pushed branch tag - if: ${{ github.ref_type == 'branch' }} - run: echo "VERSION=$(git tag --points-at HEAD)" >> "$GITHUB_ENV" + - name: Determine version + run: | + if [ "${{ github.ref_type }}" == "tag" ]; then + VERSION="${{ github.ref_name }}" + elif [ "${{ github.ref_type }}" == "branch" ]; then + VERSION=$(git tag --points-at HEAD) + if [ -z "$VERSION" ]; then + VERSION="${{ github.ref_name }}" + fi + fi + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + echo "Determined version: $VERSION" - name: Validate release run: tools/check-release.sh --version=${VERSION}