-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (71 loc) · 2.45 KB
/
Copy pathprepare-beta.yml
File metadata and controls
81 lines (71 loc) · 2.45 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
81
name: Prepare Beta Release
on:
workflow_dispatch:
inputs:
version:
description: Stable SemVer series, for example 0.1.0
required: true
type: string
concurrency:
group: prepare-beta-${{ inputs.version }}
cancel-in-progress: false
jobs:
prepare:
if: github.ref_name == 'main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.5"
- name: Validate requested version
env:
VERSION: ${{ inputs.version }}
run: |
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::version must be a stable SemVer such as 0.1.0"
exit 1
fi
- name: Prepare isolated beta branch
env:
VERSION: ${{ inputs.version }}
run: |
branch="release/${VERSION}-beta"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin main
if git ls-remote --exit-code --heads origin "${branch}" >/dev/null 2>&1; then
git fetch origin "${branch}"
git checkout --branch "${branch}" --track "origin/${branch}"
git merge --no-edit origin/main
else
git checkout --branch "${branch}" origin/main
bunx changeset pre enter beta
fi
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Calculate next beta version
run: bun run release:version
- name: Validate calculated beta version
id: release
run: >-
bun run scripts/release/channel.ts validate
--channel beta
--ref "release/${{ inputs.version }}-beta"
--expected "${{ inputs.version }}"
--output "$GITHUB_OUTPUT"
- name: Commit and push beta branch
env:
VERSION: ${{ steps.release.outputs.version }}
run: |
if git diff --quiet && git diff --cached --quiet; then
echo "::error::No unreleased changesets are available for the next beta."
exit 1
fi
git add --all
git commit --message "chore: prepare ${VERSION}"
git push origin HEAD