-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (72 loc) · 2.96 KB
/
Copy pathrelease_rc_python.yml
File metadata and controls
80 lines (72 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: Release Python RC
on:
workflow_dispatch:
inputs:
target_version:
description: Target version (e.g., 0.5.2)
type: string
required: true
permissions:
contents: write
jobs:
release_rc:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
token: ${{ secrets.GENKIT_RELEASER_GITHUB_TOKEN }}
fetch-depth: 0
- name: Pull latest & fetch tags
run: git pull origin main && git fetch --tags
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
enable-cache: true
python-version: "3.12"
version: "0.6.6"
- name: Create release branch & bump version
id: rc
env:
TARGET_VERSION: ${{ inputs.target_version }}
run: |
set -e
TARGET="$TARGET_VERSION"
[[ "$TARGET" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Error: target_version must be X.Y.Z"; exit 1; }
EXISTING=$(git tag -l "v${TARGET}-rc.*" 2>/dev/null | sed -n 's/.*-rc\.\([0-9]*\)$/\1/p' | sort -n | tail -1)
RC_NUM=$((${EXISTING:-0} + 1))
NEW="${TARGET}-rc.${RC_NUM}"
BRANCH="release/${NEW}"
echo "new=${NEW}" >> $GITHUB_OUTPUT
CUR=$(grep '^version = ' packages/genkit/pyproject.toml | cut -d'"' -f2)
git config user.email "genkit-releaser@google.com" && git config user.name "genkit-releaser"
git checkout -b "${BRANCH}"
cd .
for f in packages/genkit/pyproject.toml packages/*/pyproject.toml; do
[ -f "$f" ] && grep -q "version = \"$CUR\"" "$f" && sed -i "s/version = \"$CUR\"/version = \"$NEW\"/" "$f"
done
uv lock && cd ..
git add .
git diff --staged --quiet && { echo "::error::No version changes - $CUR may not match pyproject.toml files"; exit 1; }
git commit -m "chore: bump version to $NEW"
git push origin HEAD:"refs/heads/${BRANCH}"
- name: Create tag & GitHub release
env:
GH_TOKEN: ${{ secrets.GENKIT_RELEASER_GITHUB_TOKEN }}
RC_NEW: ${{ steps.rc.outputs.new }}
run: gh release create "v${RC_NEW}" --target "release/${RC_NEW}" --title "Genkit Python SDK v${RC_NEW}" --notes "Release candidate." --prerelease