refactor: source CLI version from code in publish workflow (#350)
Some checks are pending
Lint / lint (push) Waiting to run
Test / test (macos-latest, 3.10) (push) Waiting to run
Test / test (macos-latest, 3.11) (push) Waiting to run
Test / test (windows-latest, 3.10) (push) Waiting to run
Test / test (windows-latest, 3.11) (push) Waiting to run
Test / test (windows-latest, 3.12) (push) Waiting to run
Test / test (windows-latest, 3.13) (push) Waiting to run
Test / test-e2e (ubuntu-latest, 3.12) (push) Blocked by required conditions
Test / test-e2e (windows-latest, 3.11) (push) Blocked by required conditions
Test / test-e2e (windows-latest, 3.12) (push) Blocked by required conditions
Test / test-e2e (windows-latest, 3.13) (push) Blocked by required conditions
Test / test (macos-latest, 3.12) (push) Waiting to run
Test / test (macos-latest, 3.13) (push) Waiting to run
Test / test (ubuntu-latest, 3.10) (push) Waiting to run
Test / test (ubuntu-latest, 3.11) (push) Waiting to run
Test / test (ubuntu-latest, 3.12) (push) Waiting to run
Test / test (ubuntu-latest, 3.13) (push) Waiting to run
Test / test-e2e (macos-latest, 3.10) (push) Blocked by required conditions
Test / test-e2e (macos-latest, 3.11) (push) Blocked by required conditions
Test / test-e2e (macos-latest, 3.12) (push) Blocked by required conditions
Test / test-e2e (macos-latest, 3.13) (push) Blocked by required conditions
Test / test-e2e (ubuntu-latest, 3.10) (push) Blocked by required conditions
Test / test-e2e (ubuntu-latest, 3.11) (push) Blocked by required conditions
Test / test-e2e (ubuntu-latest, 3.13) (push) Blocked by required conditions
Test / test-e2e (windows-latest, 3.10) (push) Blocked by required conditions
Test / test-examples (3.13) (push) Blocked by required conditions

Remove the claude_code_version workflow input and instead read the CLI
version directly from src/claude_agent_sdk/_cli_version.py. This allows
the version to be managed separately and updated by automation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Ashwin Bhat 2025-11-19 09:49:35 -08:00 committed by GitHub
parent d5dc615bd4
commit bf528a1221
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,11 +7,6 @@ on:
description: 'Package version to publish (e.g., 0.1.4)'
required: true
type: string
claude_code_version:
description: 'Claude Code CLI version to bundle (e.g., 2.0.0 or latest)'
required: false
type: string
default: 'latest'
jobs:
test:
runs-on: ubuntu-latest
@ -91,7 +86,6 @@ jobs:
run: |
python scripts/build_wheel.py \
--version "${{ github.event.inputs.version }}" \
--cli-version "${{ github.event.inputs.claude_code_version }}" \
--skip-sdist \
--clean
shell: bash
@ -132,9 +126,12 @@ jobs:
run: |
python scripts/update_version.py "${{ env.VERSION }}"
- name: Update CLI version
- name: Read CLI version from code
id: cli_version
run: |
python scripts/update_cli_version.py "${{ github.event.inputs.claude_code_version }}"
CLI_VERSION=$(python -c "import re; print(re.search(r'__cli_version__ = \"([^\"]+)\"', open('src/claude_agent_sdk/_cli_version.py').read()).group(1))")
echo "cli_version=$CLI_VERSION" >> $GITHUB_OUTPUT
echo "Bundled CLI version: $CLI_VERSION"
- name: Download all wheel artifacts
uses: actions/download-artifact@v4
@ -181,8 +178,8 @@ jobs:
git checkout -b "$BRANCH_NAME"
# Commit version changes
git add pyproject.toml src/claude_agent_sdk/_version.py src/claude_agent_sdk/_cli_version.py
git commit -m "chore: bump version to ${{ env.VERSION }} with CLI ${{ github.event.inputs.claude_code_version }}"
git add pyproject.toml src/claude_agent_sdk/_version.py
git commit -m "chore: release v${{ env.VERSION }}"
- name: Update changelog with Claude
continue-on-error: true
@ -207,12 +204,11 @@ jobs:
## Changes
- Updated version in \`pyproject.toml\` to ${{ env.VERSION }}
- Updated version in \`src/claude_agent_sdk/_version.py\` to ${{ env.VERSION }}
- Updated bundled CLI version in \`src/claude_agent_sdk/_cli_version.py\` to ${{ github.event.inputs.claude_code_version }}
- Updated \`CHANGELOG.md\` with release notes
## Release Information
- Published to PyPI: https://pypi.org/project/claude-agent-sdk/${{ env.VERSION }}/
- Bundled CLI version: ${{ github.event.inputs.claude_code_version }}
- Bundled CLI version: ${{ steps.cli_version.outputs.cli_version }}
- Install with: \`pip install claude-agent-sdk==${{ env.VERSION }}\`
🤖 Generated by GitHub Actions"