diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index b8fe896efe2..ce23dbc9add 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -3,20 +3,27 @@ name: Update Version on: release: types: [released] + workflow_dispatch: + inputs: + version: + type: string + required: true jobs: update: runs-on: ubuntu-latest + env: + VERSION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.event.release.name }} permissions: contents: write pull-requests: write steps: - - name: Check release name + - name: Validate version id: version run: | - # User can input anything so check what is provided as release name - echo "${{ github.event.release.name }}" | grep -q -e "^[0-9]*\.[0-9]*\.[0-9]*$" || { - echo "Release name [$RELEASE_NAME] is not in expected format '^[0-9]*\.[0-9]*\.[0-9]*$'" + # Validate provided version compatible with the format + echo "${{ env.VERSION }}" | grep -q -e "^[0-9]*\.[0-9]*\.[0-9]*$" || { + echo "Version ["${{ env.VERSION }}"] is not in expected format '^[0-9]*\.[0-9]*\.[0-9]*$'" exit 1 } @@ -32,5 +39,5 @@ jobs: - name: Update version run: .github/scripts/update-version.sh env: - VERSION: ${{ github.event.release.name }} + VERSION: ${{ env.VERSION }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}