-
Notifications
You must be signed in to change notification settings - Fork 7
66 lines (57 loc) · 2.54 KB
/
prepare-release.yml
File metadata and controls
66 lines (57 loc) · 2.54 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
# Starts the stable Python SDK release process by opening a PR that bumps the
# package version. Merge the PR to trigger the approval-gated publish workflow.
name: Prepare Stable Python SDK Release
on:
workflow_dispatch:
inputs:
version:
description: "Stable version to release (e.g., 0.22.0)"
required: true
type: string
permissions:
contents: write
pull-requests: write
jobs:
prepare:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Validate version format
run: python py/scripts/validate-release.py stable --version "${{ inputs.version }}" --validate-version-only
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
with:
app-id: ${{ secrets.BRAINTRUST_BOT_APP_ID }}
private-key: ${{ secrets.BRAINTRUST_BOT_PRIVATE_KEY }}
- name: Bump version
run: python py/scripts/validate-release.py stable --version "${{ inputs.version }}" --set-version
- name: Compute changeset link
id: changeset
env:
VERSION: ${{ inputs.version }}
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
run: |
LAST_TAG=$(git tag --sort=-version:refname 'py-sdk-v*' | head -n 1 || true)
if [[ -n "$LAST_TAG" ]]; then
URL="${REPO_URL}/compare/${LAST_TAG}...release/py-sdk-v${VERSION}"
echo "body=Changeset since [\`${LAST_TAG}\`](${REPO_URL}/releases/tag/${LAST_TAG}): ${URL}" >> "$GITHUB_OUTPUT"
else
URL="${REPO_URL}/commits/release/py-sdk-v${VERSION}"
echo "body=Changeset: ${URL}" >> "$GITHUB_OUTPUT"
fi
- name: Create pull request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ steps.app-token.outputs.token }}
add-paths: py/src/braintrust/version.py
branch: release/py-sdk-v${{ inputs.version }}
commit-message: "chore: release Python SDK v${{ inputs.version }}"
title: "chore: release Python SDK v${{ inputs.version }}"
body: |
Automated stable Python SDK release PR for `${{ inputs.version }}`. Merging will trigger approval-gated publishing and create the `py-sdk-v${{ inputs.version }}` release tag.
${{ steps.changeset.outputs.body }}