Skip to content

Commit 882bef4

Browse files
committed
make new ci publish script
1 parent d4d853d commit 882bef4

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"changeset:version": "changeset version",
4343
"changeset:publish": "changeset publish",
4444
"ci:version": "changeset version && bun update",
45-
"ci:publish": "for dir in packages/*; do (cd \"$dir\" && bun publish || true); done && changeset tag",
45+
"ci:publish": "./scripts/ci-publish.sh",
4646
"prepare": "husky",
4747
"codegen": "turbo run codegen"
4848
},

scripts/ci-publish.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo "Publishing packages in dependency order..."
5+
6+
# First, publish packages/codama/* (lowest level dependencies)
7+
echo "Publishing codama packages..."
8+
for dir in packages/codama/*; do
9+
if [ -d "$dir" ] && [ -f "$dir/package.json" ]; then
10+
if ! grep -q '"private": true' "$dir/package.json"; then
11+
echo "Publishing $(basename "$dir")..."
12+
(cd "$dir" && bun publish --access public) || echo "Failed to publish $(basename "$dir"), continuing..."
13+
fi
14+
fi
15+
done
16+
17+
# Then, publish packages/clients/* (depends on codama)
18+
echo "Publishing client packages..."
19+
for dir in packages/clients/*; do
20+
if [ -d "$dir" ] && [ -f "$dir/package.json" ]; then
21+
if ! grep -q '"private": true' "$dir/package.json"; then
22+
echo "Publishing $(basename "$dir")..."
23+
(cd "$dir" && bun publish --access public) || echo "Failed to publish $(basename "$dir"), continuing..."
24+
fi
25+
fi
26+
done
27+
28+
# Finally, publish packages/* (top level, may depend on clients)
29+
echo "Publishing top-level packages..."
30+
for dir in packages/*; do
31+
# Skip subdirectories we already processed
32+
if [ "$dir" != "packages/codama" ] && [ "$dir" != "packages/clients" ]; then
33+
if [ -d "$dir" ] && [ -f "$dir/package.json" ]; then
34+
if ! grep -q '"private": true' "$dir/package.json"; then
35+
echo "Publishing $(basename "$dir")..."
36+
(cd "$dir" && bun publish --access public) || echo "Failed to publish $(basename "$dir"), continuing..."
37+
fi
38+
fi
39+
fi
40+
done
41+
42+
# Tag the release in git
43+
echo "Creating git tags..."
44+
changeset tag
45+
46+
echo "Publishing complete!"

0 commit comments

Comments
 (0)