-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (60 loc) · 2.25 KB
/
Copy pathrelease-pr.yml
File metadata and controls
71 lines (60 loc) · 2.25 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
name: Release PR
on:
workflow_dispatch:
inputs:
version:
description: "Next version (e.g. 1.2.0)"
required: true
type: string
jobs:
open-release-pr:
name: Bump version and open release PR
runs-on: ubuntu-latest
steps:
- name: Validate version format
run: |
if ! [[ "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Version must be X.Y.Z (no pre-release suffixes). Got: ${{ inputs.version }}"
exit 1
fi
- uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
token: ${{ secrets.RELEASE_PR_TOKEN }}
- name: Confirm version is strictly greater than current
run: |
CURRENT=$(node -p "require('./package.json').version")
NEXT="${{ inputs.version }}"
HIGHEST=$(printf '%s\n%s\n' "$CURRENT" "$NEXT" | sort -V | tail -n1)
if [ "$CURRENT" = "$NEXT" ] || [ "$HIGHEST" != "$NEXT" ]; then
echo "::error::New version ($NEXT) must be strictly greater than current ($CURRENT)"
exit 1
fi
echo "Bumping $CURRENT -> $NEXT"
- uses: oven-sh/setup-bun@v2
- name: Bump version in all manifests
run: bun scripts/bump-version.ts "${{ inputs.version }}"
- name: Commit and push bump
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "chore: bump version to ${{ inputs.version }}"
git push origin dev
- name: Open release PR
env:
GH_TOKEN: ${{ secrets.RELEASE_PR_TOKEN }}
run: |
PR_BODY_FILE=$(mktemp)
cat > "$PR_BODY_FILE" <<'EOF'
<!-- release-notes -->
## Release notes
_Replace this paragraph with a short narrative for the release. If left unchanged, GitHub's auto-generated notes will be used instead._
EOF
PR_URL=$(gh pr create \
--base main \
--head dev \
--title "Release v${{ inputs.version }}" \
--body-file "$PR_BODY_FILE")
echo "Opened release PR: $PR_URL" >> "$GITHUB_STEP_SUMMARY"