-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (60 loc) · 2.1 KB
/
release-prep.yml
File metadata and controls
68 lines (60 loc) · 2.1 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
name: Prep Release
on:
workflow_dispatch:
inputs:
bump:
description: 'Version bump type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
permissions: {}
jobs:
create-release-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version and sync
id: sync
run: |
CURRENT=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
case "${{ inputs.bump }}" in
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
patch) PATCH=$((PATCH + 1)) ;;
esac
VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
bash scripts/version-sync.sh "$VERSION"
- name: Create release branch and PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.sync.outputs.VERSION }}"
BRANCH="release/v${VERSION}"
git checkout -b "$BRANCH"
git add Cargo.toml npm/ pypi/
git commit -m "v${VERSION}: bump and sync package versions"
git push origin "$BRANCH"
gh pr create \
--title "v${VERSION}: bump and sync package versions" \
--body "## Release v${VERSION}
Automated version bump (${{ inputs.bump }}).
**Merge this PR to trigger the release workflow**, which will:
1. Tag the merge commit as \`v${VERSION}\`
2. Build binaries for all platforms
3. Publish to npm, crates.io, PyPI, and GitHub Releases" \
--base main \
--head "$BRANCH"