Skip to content

Bump version

Bump version #4

Workflow file for this run

# Takes in how to bump version as input
# Commits changes to bump version and outputs the new version and commit hash as output
name: Bump version
on:
workflow_dispatch:
inputs:
change:
type: choice
description: Python script name to update the version
required: true
options:
- bump-dev-num
- promote-dev-build-to-rc
- promote-rc-build-to-release
workflow_call:
inputs:
change:
# Since workflow_call doesn't support 'options' input type,
# we take in a string instead that must be a valid Python script name (excluding the .py part)
# Example: bump-dev-num for bump-dev-num.py
type: string
description: Python script name to change version
required: true
ref:
required: false
description: Commit to bump off of
type: string
is_workflow_call:
type: boolean
default: true
required: false
secrets:
CLIENT_BOT_PAT:
required: true
outputs:
new_version:
value: ${{ jobs.get-new-version.outputs.new_version }}
bump_sha:
value: ${{ jobs.update-version-in-repo.outputs.bump_sha }}
jobs:
get-current-version:
name: Get new version string
runs-on: ubuntu-22.04
outputs:
current_version: ${{ steps.get-current-version.outputs.current_version }}
steps:
# Checkout the branch where we want to bump the new version
- uses: actions/checkout@v4
with:
token: ${{ secrets.CLIENT_BOT_PAT }}
ref: ${{ inputs.ref }}
- name: Get current version
id: get-current-version
run: echo current_version=$(cat VERSION) >> $GITHUB_OUTPUT
get-new-version:
runs-on: ubuntu-22.04
needs: get-current-version
outputs:
new_version: ${{ steps.get-new-version.outputs.new_version }}
steps:
# Checkout branch where workflow is being called from
- uses: actions/checkout@v4
- name: Install library that parses PEP 440 versions
run: pip install parver -c requirements.txt
working-directory: .github/workflows
- name: Get new version
id: get-new-version
run: echo new_version=$(python3 .github/workflows/${{ inputs.change }}.py ${{ needs.get-current-version.outputs.current_version }}) >> $GITHUB_OUTPUT
update-version-in-repo:
needs: get-new-version
uses: ./.github/workflows/update-version.yml
with:
new_version: ${{ needs.get-new-version.outputs.new_version }}
ref: ${{ inputs.is_workflow_call && inputs.ref || github.ref }}
secrets: inherit