-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (82 loc) · 3.03 KB
/
changesets.yml
File metadata and controls
100 lines (82 loc) · 3.03 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Changesets
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Setup Node.js (for npm publish)
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org"
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Build Packages
run: bun run build
- name: Replace workspace protocol
run: |
VERSION=$(jq -r '.version' packages/core/package.json)
echo "Replacing workspace:* with ^${VERSION}"
find packages -name "package.json" -type f -exec sed -i 's/"workspace:\*"/"^'"${VERSION}"'"/g' {} \;
if grep -r '"workspace:' packages/ --include="package.json" 2>/dev/null; then
echo "ERROR: workspace: protocol still found!"
exit 1
fi
echo "✅ All workspace:* replaced with ^${VERSION}"
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
version: bun run version
publish: bun run release
title: "chore: version packages"
commit: "chore: version packages"
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
- name: Create GitHub Release
if: steps.changesets.outputs.published == 'true'
run: |
VERSION=$(jq -r '.version' packages/core/package.json)
TAG="v${VERSION}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, skipping"
exit 0
fi
git tag "$TAG"
git push origin "$TAG"
PACKAGES='${{ steps.changesets.outputs.publishedPackages }}'
BODY="## Published Packages\n\n"
BODY+=$(echo "$PACKAGES" | jq -r '.[] | "- \(.name)@\(.version)"')
gh release create "$TAG" \
--title "Release $TAG" \
--notes "$BODY"
echo "Created release $TAG"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Summary
if: steps.changesets.outputs.published == 'true'
run: |
VERSION=$(jq -r '.version' packages/core/package.json)
echo "## ✅ Packages Published" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** v${VERSION}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Published packages:" >> $GITHUB_STEP_SUMMARY
echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | "- `\(.name)@\(.version)`"' >> $GITHUB_STEP_SUMMARY