Skip to content

Commit d9ee02c

Browse files
authored
chore: Simplify release process (#1849)
1 parent 13ce81d commit d9ee02c

18 files changed

Lines changed: 456 additions & 1378 deletions

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config/schema.json",
33
"changelog": [
4-
"./.changeset/changelog.cjs",
4+
"./changelog.cjs",
55
{
66
"repo": "braintrustdata/braintrust-sdk-javascript",
77
"ignoredAuthors": ["abhiprasad", "lforst", "qard"]

.github/workflows/_run-js-release-mode.yaml

Lines changed: 0 additions & 162 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Backsync Release To Main
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: backsync-release-to-main
14+
cancel-in-progress: false
15+
16+
env:
17+
HUSKY: "0"
18+
19+
jobs:
20+
backsync:
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 15
23+
steps:
24+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
25+
with:
26+
fetch-depth: 0
27+
- name: Fetch main
28+
run: git fetch origin main:refs/remotes/origin/main
29+
- name: Create or reuse backsync branch
30+
id: backsync_branch
31+
run: |
32+
release_sha="$(git rev-parse HEAD)"
33+
short_release_sha="$(git rev-parse --short=12 "$release_sha")"
34+
branch_name="backsync/${short_release_sha}"
35+
36+
git config user.name "github-actions[bot]"
37+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38+
git switch --create "$branch_name" "$release_sha"
39+
git push origin "HEAD:refs/heads/$branch_name"
40+
41+
echo "branch_name=$branch_name" >> "$GITHUB_OUTPUT"
42+
echo "short_release_sha=$short_release_sha" >> "$GITHUB_OUTPUT"
43+
- name: Create backsync PR
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
run: |
47+
pr_url="$(gh pr create \
48+
--base main \
49+
--head "${{ steps.backsync_branch.outputs.branch_name }}" \
50+
--title "chore: Sync release branch to main (${{ steps.backsync_branch.outputs.short_release_sha }})" \
51+
--body "Synchronizes the main branch with the release branch. (changed files should generally only be package versions, changeset files, and changelogs)")"
52+
gh pr merge --auto --squash "$pr_url"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Prepare Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
concurrency:
11+
group: prepare-js-release-${{ github.ref_name }}
12+
cancel-in-progress: false
13+
14+
env:
15+
HUSKY: "0"
16+
17+
jobs:
18+
prepare-release:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 20
21+
steps:
22+
- name: Require main branch
23+
run: |
24+
if [ "${{ github.ref_name }}" != "main" ]; then
25+
{
26+
echo "## Prepare JS release"
27+
echo
28+
echo "This workflow must be run from \`main\`. Selected ref: \`${{ github.ref_name }}\`."
29+
} >> "$GITHUB_STEP_SUMMARY"
30+
exit 1
31+
fi
32+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
33+
with:
34+
fetch-depth: 0
35+
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
36+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
37+
with:
38+
node-version-file: .tool-versions
39+
cache: pnpm
40+
- name: Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
- name: Validate publishable package metadata
43+
run: node scripts/release/validate-publishable-packages.mjs
44+
- name: Record source commit and release branch
45+
id: source
46+
run: |
47+
main_sha="$(git rev-parse HEAD)"
48+
short_main_sha="$(git rev-parse --short=12 HEAD)"
49+
release_branch="release/${short_main_sha}"
50+
51+
{
52+
echo "main_sha=$main_sha"
53+
echo "short_main_sha=$short_main_sha"
54+
echo "release_branch=$release_branch"
55+
} >> "$GITHUB_OUTPUT"
56+
- name: Run changeset version
57+
run: pnpm exec changeset version
58+
- name: Create release commit
59+
run: |
60+
git config user.name "github-actions[bot]"
61+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
62+
git switch -c "${{ steps.source.outputs.release_branch }}"
63+
git add -A
64+
git commit -m "chore: Prepare changelog"
65+
git push origin HEAD:refs/heads/${{ steps.source.outputs.release_branch }}
66+
- name: Create release PR
67+
env:
68+
GH_TOKEN: ${{ github.token }}
69+
run: |
70+
gh pr create \
71+
--base release \
72+
--head "${{ steps.source.outputs.release_branch }}" \
73+
--title "chore: Prepare for release (${{ steps.source.outputs.short_main_sha }})" \
74+
--body "Prepares a release by updating changelogs and package versions, and synchronizing everything to the release branch."

.github/workflows/publish-js-sdk-canary-scheduler.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)