Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/create-release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Create Release Tag

on:
pull_request:
types: [closed]
branches: [main]

jobs:
create-tag:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v')
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract version from branch name
id: extract_version
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION="${BRANCH_NAME#release/v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Create and push tag
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

# Create annotated tag
git tag -a "v${{ steps.extract_version.outputs.version }}" \
-m "Release v${{ steps.extract_version.outputs.version }}"

# Push tag
git push origin "v${{ steps.extract_version.outputs.version }}"

- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.extract_version.outputs.version }}
release_name: Release v${{ steps.extract_version.outputs.version }}
body: |
## Release v${{ steps.extract_version.outputs.version }}

Published to PyPI: https://pypi.org/project/claude-code-sdk/${{ steps.extract_version.outputs.version }}/

### Installation
```bash
pip install claude-code-sdk==${{ steps.extract_version.outputs.version }}
```

### What's Changed
See the [full changelog](https://github.com/${{ github.repository }}/compare/v${{ steps.extract_version.outputs.version }}...v${{ steps.extract_version.outputs.version }})
draft: false
prerelease: false
44 changes: 43 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ jobs:
publish:
needs: [test, lint]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
Expand Down Expand Up @@ -108,4 +113,41 @@ jobs:
run: |
twine upload dist/*
echo "Package published to PyPI"
echo "Install with: pip install claude-code-sdk==${{ github.event.inputs.version }}"
echo "Install with: pip install claude-code-sdk==${{ github.event.inputs.version }}"

- name: Create version update PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create a new branch for the version update
BRANCH_NAME="release/v${{ github.event.inputs.version }}"
git checkout -b "$BRANCH_NAME"

# Configure git
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

# Commit the version changes
git add pyproject.toml src/claude_code_sdk/__init__.py
git commit -m "chore: bump version to ${{ github.event.inputs.version }}"

# Push the branch
git push origin "$BRANCH_NAME"

# Create PR using GitHub CLI (gh)
gh pr create \
--title "chore: bump version to ${{ github.event.inputs.version }}" \
--body "This PR updates the version to ${{ github.event.inputs.version }} after publishing to PyPI.

## Changes
- Updated version in \`pyproject.toml\`
- Updated version in \`src/claude_code_sdk/__init__.py\`

## Release Information
- Published to PyPI: https://pypi.org/project/claude-code-sdk/${{ github.event.inputs.version }}/
- Install with: \`pip install claude-code-sdk==${{ github.event.inputs.version }}\`

## Next Steps
After merging this PR, a release tag will be created automatically." \
--base main \
--head "$BRANCH_NAME"