-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (81 loc) · 2.82 KB
/
changesets.yml
File metadata and controls
98 lines (81 loc) · 2.82 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
name: Changesets
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
TURBO_CACHE_DIR: .turbo
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: Cache Turbo
uses: actions/cache@v4
with:
path: .turbo
key: turbo-release-${{ runner.os }}-${{ hashFiles('**/bun.lock') }}-${{ github.sha }}
restore-keys: |
turbo-release-${{ runner.os }}-${{ hashFiles('**/bun.lock') }}-
turbo-release-${{ runner.os }}-
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Build Packages
run: bun run build
- 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 Releases (per package)
if: steps.changesets.outputs.published == 'true'
run: |
PACKAGES='${{ steps.changesets.outputs.publishedPackages }}'
echo "$PACKAGES" | jq -c '.[]' | while read -r pkg; do
NAME=$(echo "$pkg" | jq -r '.name')
VERSION=$(echo "$pkg" | jq -r '.version')
# @commonxjs/sqlite@0.2.0 -> sqlite-v0.2.0
SHORT=$(echo "$NAME" | sed 's/@commonxjs\///')
TAG="${SHORT}-v${VERSION}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, skipping"
continue
fi
git tag "$TAG"
git push origin "$TAG"
gh release create "$TAG" \
--title "${NAME}@${VERSION}" \
--notes "Published ${NAME}@${VERSION}"
echo "Created release $TAG"
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Summary
if: steps.changesets.outputs.published == 'true'
run: |
echo "## Packages Published" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | "- `\(.name)@\(.version)`"' >> $GITHUB_STEP_SUMMARY