Skip to content

Commit de75397

Browse files
committed
ci: add release-please automation with versioned branch workflow
- Add release-please config and manifest for Python releases - Add release-please workflow triggered on release/** branches - Add PyPI publish workflow on GitHub release - Add helper workflow to cut release branches from main
1 parent cc56a5e commit de75397

5 files changed

Lines changed: 121 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.2.0"
3+
}

.github/release-please-config.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"packages": {
4+
".": {
5+
"release-type": "python",
6+
"package-name": "google-adk-community",
7+
"changelog-path": "CHANGELOG.md",
8+
"extra-files": [
9+
"src/google/adk_community/version.py"
10+
],
11+
"changelog-sections": [
12+
{"type": "feat", "section": "Features"},
13+
{"type": "fix", "section": "Bug Fixes"},
14+
{"type": "perf", "section": "Performance Improvements"},
15+
{"type": "refactor", "section": "Code Refactoring"},
16+
{"type": "docs", "section": "Documentation"},
17+
{"type": "test", "section": "Tests", "hidden": true},
18+
{"type": "build", "section": "Build System", "hidden": true},
19+
{"type": "ci", "section": "CI/CD", "hidden": true},
20+
{"type": "style", "section": "Styles", "hidden": true},
21+
{"type": "chore", "section": "Miscellaneous Chores", "hidden": true}
22+
]
23+
}
24+
}
25+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Cut Release Branch
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version for the release branch (e.g., 0.3.0)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
cut-branch:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
ref: main
21+
fetch-depth: 0
22+
23+
- name: Validate version format
24+
run: |
25+
if ! echo "${{ inputs.version }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
26+
echo "Error: Version must be in format X.Y.Z (e.g., 0.3.0)"
27+
exit 1
28+
fi
29+
30+
- name: Create release branch
31+
run: |
32+
BRANCH_NAME="release/v${{ inputs.version }}"
33+
git checkout -b "$BRANCH_NAME"
34+
git push origin "$BRANCH_NAME"
35+
echo "Created and pushed branch: $BRANCH_NAME"
36+
echo "Release-please will now create a release PR on this branch."

.github/workflows/publish-pypi.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v4
19+
with:
20+
version: "latest"
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Build package
28+
run: uv build
29+
30+
- name: Publish to PyPI
31+
env:
32+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
33+
run: uv publish
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/**'
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
18+
steps:
19+
- uses: googleapis/release-please-action@v4
20+
id: release
21+
with:
22+
config-file: .github/release-please-config.json
23+
manifest-file: .github/.release-please-manifest.json
24+
target-branch: ${{ github.ref_name }}

0 commit comments

Comments
 (0)