Bump Package Version #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Bump Package Version | |
| on: | |
| workflow_call: | |
| inputs: | |
| package_name: | |
| required: true | |
| type: string | |
| description: "Name of the package to bump (e.g., keycardai-oauth)" | |
| package_dir: | |
| required: true | |
| type: string | |
| description: "Directory of the package (e.g., packages/oauth)" | |
| target_branch: | |
| required: false | |
| type: string | |
| default: main | |
| description: "Branch that receives the bump PR" | |
| increment: | |
| required: false | |
| type: string | |
| default: auto | |
| description: "Optional forced increment: major, minor, or patch" | |
| workflow_dispatch: | |
| inputs: | |
| package_name: | |
| required: true | |
| type: string | |
| package_dir: | |
| required: true | |
| type: string | |
| target_branch: | |
| required: false | |
| type: string | |
| default: main | |
| increment: | |
| required: false | |
| type: choice | |
| default: auto | |
| options: | |
| - auto | |
| - major | |
| - minor | |
| - patch | |
| jobs: | |
| bump: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| environment: pypi-release | |
| steps: | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Generate GitHub App token | |
| id: generate-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ vars.SDK_RELEASE_APP_ID }} | |
| private-key: ${{ secrets.SDK_RELEASE_PRIVATE_KEY }} | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install commitizen | |
| run: uv tool install commitizen | |
| - name: Bump version for ${{ inputs.package_name }} | |
| env: | |
| GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| run: | | |
| ARGS=(--target-branch "${{ inputs.target_branch }}") | |
| if [[ "${{ inputs.increment }}" != "auto" && -n "${{ inputs.increment }}" ]]; then | |
| ARGS+=(--increment "${{ inputs.increment }}") | |
| fi | |
| uv run python scripts/bump_package.py "${{ inputs.package_name }}" "${{ inputs.package_dir }}" "${ARGS[@]}" |