Skip to content

Commit bf528a1

Browse files
ashwin-antclaude
andauthored
refactor: source CLI version from code in publish workflow (#350)
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 <[email protected]>
1 parent d5dc615 commit bf528a1

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ on:
77
description: 'Package version to publish (e.g., 0.1.4)'
88
required: true
99
type: string
10-
claude_code_version:
11-
description: 'Claude Code CLI version to bundle (e.g., 2.0.0 or latest)'
12-
required: false
13-
type: string
14-
default: 'latest'
1510
jobs:
1611
test:
1712
runs-on: ubuntu-latest
@@ -91,7 +86,6 @@ jobs:
9186
run: |
9287
python scripts/build_wheel.py \
9388
--version "${{ github.event.inputs.version }}" \
94-
--cli-version "${{ github.event.inputs.claude_code_version }}" \
9589
--skip-sdist \
9690
--clean
9791
shell: bash
@@ -132,9 +126,12 @@ jobs:
132126
run: |
133127
python scripts/update_version.py "${{ env.VERSION }}"
134128
135-
- name: Update CLI version
129+
- name: Read CLI version from code
130+
id: cli_version
136131
run: |
137-
python scripts/update_cli_version.py "${{ github.event.inputs.claude_code_version }}"
132+
CLI_VERSION=$(python -c "import re; print(re.search(r'__cli_version__ = \"([^\"]+)\"', open('src/claude_agent_sdk/_cli_version.py').read()).group(1))")
133+
echo "cli_version=$CLI_VERSION" >> $GITHUB_OUTPUT
134+
echo "Bundled CLI version: $CLI_VERSION"
138135
139136
- name: Download all wheel artifacts
140137
uses: actions/download-artifact@v4
@@ -181,8 +178,8 @@ jobs:
181178
git checkout -b "$BRANCH_NAME"
182179
183180
# Commit version changes
184-
git add pyproject.toml src/claude_agent_sdk/_version.py src/claude_agent_sdk/_cli_version.py
185-
git commit -m "chore: bump version to ${{ env.VERSION }} with CLI ${{ github.event.inputs.claude_code_version }}"
181+
git add pyproject.toml src/claude_agent_sdk/_version.py
182+
git commit -m "chore: release v${{ env.VERSION }}"
186183
187184
- name: Update changelog with Claude
188185
continue-on-error: true
@@ -207,12 +204,11 @@ jobs:
207204
## Changes
208205
- Updated version in \`pyproject.toml\` to ${{ env.VERSION }}
209206
- Updated version in \`src/claude_agent_sdk/_version.py\` to ${{ env.VERSION }}
210-
- Updated bundled CLI version in \`src/claude_agent_sdk/_cli_version.py\` to ${{ github.event.inputs.claude_code_version }}
211207
- Updated \`CHANGELOG.md\` with release notes
212208
213209
## Release Information
214210
- Published to PyPI: https://pypi.org/project/claude-agent-sdk/${{ env.VERSION }}/
215-
- Bundled CLI version: ${{ github.event.inputs.claude_code_version }}
211+
- Bundled CLI version: ${{ steps.cli_version.outputs.cli_version }}
216212
- Install with: \`pip install claude-agent-sdk==${{ env.VERSION }}\`
217213
218214
🤖 Generated by GitHub Actions"

0 commit comments

Comments
 (0)