Skip to content

Commit a6b828d

Browse files
author
skychx
committed
ci(config): update
1 parent a9df55e commit a6b828d

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

.github/workflows/publish.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,39 @@ jobs:
4646
- name: Build
4747
run: pnpm run build
4848

49+
- name: Extract version from tag
50+
id: version
51+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
52+
53+
- name: Update package versions to tag version
54+
run: |
55+
VERSION="${{ steps.version.outputs.VERSION }}"
56+
echo "Updating all packages to version $VERSION"
57+
58+
# Update all package.json files in packages directory
59+
for pkg in packages/*/package.json; do
60+
echo "Updating $pkg to version $VERSION"
61+
jq --arg version "$VERSION" '.version = $version' "$pkg" > tmp.json && mv tmp.json "$pkg"
62+
done
63+
64+
- name: Create GitHub Release
65+
uses: softprops/action-gh-release@v1
66+
with:
67+
tag_name: ${{ github.ref_name }}
68+
name: Release ${{ steps.version.outputs.VERSION }}
69+
draft: false
70+
prerelease: false
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
4974
- name: Publish to npm
50-
run: pnpm publish -r --filter "{packages/*}" --access public --no-git-checks --provenance
75+
run: |
76+
VERSION="${{ steps.version.outputs.VERSION }}"
77+
# Check if version contains pre-release identifier
78+
if [[ "$VERSION" =~ -[a-zA-Z0-9.-]+$ ]]; then
79+
# This is a pre-release version
80+
pnpm publish -r --filter "{packages/*}" --access public --no-git-checks --tag beta
81+
else
82+
# This is a stable release
83+
pnpm publish -r --filter "{packages/*}" --access public --no-git-checks --tag latest
84+
fi

0 commit comments

Comments
 (0)