Skip to content

Commit f895a30

Browse files
zaniebclaude
andauthored
Add job to prepare a release branch (#19292)
We don't need to run this locally --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3ff510a commit f895a30

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Bump the uv version and create a pull request.
2+
name: "Prepare release"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
bump:
8+
description: "The version bump type (auto-detected from PR labels if not specified)"
9+
required: false
10+
type: string
11+
version:
12+
description: "The exact version to set (overrides bump)"
13+
required: false
14+
type: string
15+
16+
permissions: {}
17+
18+
jobs:
19+
release:
20+
if: github.repository == 'astral-sh/uv'
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
steps:
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
with:
28+
fetch-depth: 0
29+
persist-credentials: false
30+
31+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
32+
with:
33+
version: "latest"
34+
enable-cache: true
35+
36+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
37+
with:
38+
save-if: false
39+
40+
- name: "Configure Git"
41+
run: |
42+
git config user.name "github-actions[bot]"
43+
git config user.email "github-actions[bot]@users.noreply.github.com"
44+
45+
- name: "Bump version"
46+
run: |
47+
if [ -n "$INPUT_VERSION" ]; then
48+
./scripts/release.sh --version "$INPUT_VERSION"
49+
elif [ -n "$INPUT_BUMP" ]; then
50+
./scripts/release.sh --bump "$INPUT_BUMP"
51+
else
52+
./scripts/release.sh
53+
fi
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
INPUT_VERSION: ${{ inputs.version }}
57+
INPUT_BUMP: ${{ inputs.bump }}
58+
59+
- name: "Create Pull Request"
60+
run: |
61+
branch="$(git branch --show-current)"
62+
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:"$branch"
63+
gh pr create \
64+
--base main \
65+
--head "$branch" \
66+
--fill
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)