From 1bb4a5d67682e8e0743a8187656d81242c79615b Mon Sep 17 00:00:00 2001 From: Jerad Rutnam Date: Fri, 27 Sep 2024 08:32:02 +0530 Subject: [PATCH] Update release-docs.yml --- .github/workflows/release-docs.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-docs.yml b/.github/workflows/release-docs.yml index 38219129fd..d1ddb7a12b 100644 --- a/.github/workflows/release-docs.yml +++ b/.github/workflows/release-docs.yml @@ -7,6 +7,11 @@ on: paths-ignore: - 'VERSION' # This will ignore changes only to the VERSION file. workflow_dispatch: + inputs: + version: + description: 'Version to tag (e.g., 0.0.1). Leave empty to use CURRENT_VERSION from environment.' + required: false # This input is optional + default: '' env: # Global environment variables GIT_USERNAME: ${{ secrets.GIT_USERNAME }} @@ -43,11 +48,17 @@ jobs: - name: Increment version run: | - set -euxo pipefail - IFS='.' read -r MAJOR MINOR PATCH <<< "${{ env.CURRENT_VERSION }}" - echo "Current version: MAJOR=$MAJOR, MINOR=$MINOR, PATCH=$PATCH" - PATCH=$((PATCH+1)) - NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}" + NEW_VERSION="${{ github.event.inputs.version }}" + + if [[ -z "$VERSION" ]]; then + set -euxo pipefail + IFS='.' read -r MAJOR MINOR PATCH <<< "${{ env.CURRENT_VERSION }}" + echo "Current version: MAJOR=$MAJOR, MINOR=$MINOR, PATCH=$PATCH" + PATCH=$((PATCH+1)) + NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}" + echo "Version is auto incremented." + fi + echo "New version: $NEW_VERSION" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV shell: bash