From 2791c60bb22b8b0014b38942457025c892df04b7 Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Mon, 2 Dec 2024 22:09:08 -0800 Subject: [PATCH] ci: Removed branch testing due to checkout confusion between branch vs tag - Removed branch testing as it is not required. Point releases will trigger the event due to `tag` push even when it is not from master branch. - Added version in inputs for testing - Added missing `inputs` tag Changelog-None. --- .github/workflows/release.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 841a2e640687..a3cf09a6bc57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,10 @@ on: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+[0-9a-z]+' workflow_dispatch: + inputs: + version: + description: 'Release version' + required: true create_release: description: Create a draft release default: no @@ -28,14 +32,18 @@ jobs: with: 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.event.inputs.version }}" != "" ]]; then + VERSION="${{ github.event.inputs.version }}" + elif [ "${{ github.ref_type }}" == "tag" ]; then + VERSION="${{ github.ref_name }}" + else + echo "No release version provided and no tag found." + exit 1 + fi + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + echo "Determined version: $VERSION" - name: Validate release run: tools/check-release.sh --version=${VERSION} @@ -170,7 +178,7 @@ jobs: echo "release_title=$RELEASE_TITLE" >> "$GITHUB_OUTPUT" - name: Prepare release draft - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.create_release == 'yes') + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'yes') uses: softprops/action-gh-release@v2 with: name: "${{ env.version }} ${{ steps.release_data.outputs.release_title }}"