From 9a1f59b64ac800269cbb100b889a86a21b9d7c33 Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Sat, 28 Jun 2025 07:20:07 +0200 Subject: [PATCH 1/8] chore: update bump version script (#46) --- .github/workflows/bump-version.yml | 7 ++++--- scripts/bump-version.ts | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 9decd064..88b371c1 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -32,13 +32,14 @@ jobs: run: pnpm install --frozen-lockfile - name: Bump version - run: pnpm run bump-version + id: bump + run: pnpm run bump-version >> "$GITHUB_OUTPUT" - name: Create PR uses: peter-evans/create-pull-request@v7 with: - commit-message: 'chore: bump version' - title: '[CI] Bump version' + commit-message: 'chore: bump version ${{ steps.bump.outputs.new_version }}' + title: '[CI] Bump version ${{ steps.bump.outputs.new_version }}' body: Automated changes for bumping version branch: chore/ci-bump-version branch-suffix: timestamp diff --git a/scripts/bump-version.ts b/scripts/bump-version.ts index 717072e9..6538df32 100644 --- a/scripts/bump-version.ts +++ b/scripts/bump-version.ts @@ -14,7 +14,7 @@ function getWorkspacePackageJsonFiles(workspaceFile: string): string[] { cwd: rootDir, absolute: true, }); - matches.forEach((f) => files.add(f)); + matches.filter((f) => !f.includes('node_modules')).forEach((f) => files.add(f)); } return Array.from(files); } @@ -28,16 +28,27 @@ function incrementVersion(version: string): string { return parts.join('.'); } +// find all package.json files in the workspace const workspaceFile = path.resolve(__dirname, '../pnpm-workspace.yaml'); const packageFiles = getWorkspacePackageJsonFiles(workspaceFile); +// get version from root package.json +const rootPackageJson = path.resolve(__dirname, '../package.json'); +const rootPkg = JSON.parse(fs.readFileSync(rootPackageJson, 'utf8')) as { version?: string }; +if (!rootPkg.version) throw new Error('No "version" key found in package.json'); +const rootVersion = rootPkg.version; +const newVersion = incrementVersion(rootVersion); + for (const file of packageFiles) { const content = fs.readFileSync(file, 'utf8'); const pkg = JSON.parse(content) as { version?: string }; if (pkg.version) { const oldVersion = pkg.version; - pkg.version = incrementVersion(pkg.version); - fs.writeFileSync(file, JSON.stringify(pkg, null, 2) + '\n'); - console.log(`Updated ${file}: ${oldVersion} -> ${pkg.version}`); + const newVersion = incrementVersion(pkg.version); + // do a string replace from oldVersion to newVersion + const newContent = content.replace(`"version": "${oldVersion}"`, `"version": "${newVersion}"`); + fs.writeFileSync(file, newContent); } } + +console.log(`new_version=${newVersion}`); From 7427ed0b0158c62e456963b877415d3927c13ae6 Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Sat, 28 Jun 2025 07:32:50 +0200 Subject: [PATCH 2/8] chore: fix version bump script output (#47) * chore: fix version bump script output * update CI script --- .github/workflows/bump-version.yml | 1 + scripts/bump-version.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 88b371c1..d86b2ca6 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -10,6 +10,7 @@ permissions: jobs: bump-version: runs-on: ubuntu-latest + if: github.ref == 'refs/heads/dev' steps: - name: Checkout diff --git a/scripts/bump-version.ts b/scripts/bump-version.ts index 6538df32..ac42655d 100644 --- a/scripts/bump-version.ts +++ b/scripts/bump-version.ts @@ -48,7 +48,11 @@ for (const file of packageFiles) { // do a string replace from oldVersion to newVersion const newContent = content.replace(`"version": "${oldVersion}"`, `"version": "${newVersion}"`); fs.writeFileSync(file, newContent); + console.log(`Updated ${file}: ${oldVersion} -> ${newVersion}`); } } -console.log(`new_version=${newVersion}`); +if (process.env.GITHUB_OUTPUT) { + // CI output + fs.appendFileSync(process.env.GITHUB_OUTPUT, `new_version=${newVersion}\n`); +} From 294f382c2e0a7c9002636eec0fbd797dd0f4ad9b Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Sat, 28 Jun 2025 07:34:41 +0200 Subject: [PATCH 3/8] chore: fix CI bump version script (#48) --- .github/workflows/bump-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index d86b2ca6..f28e6b4e 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -34,7 +34,7 @@ jobs: - name: Bump version id: bump - run: pnpm run bump-version >> "$GITHUB_OUTPUT" + run: pnpm run bump-version - name: Create PR uses: peter-evans/create-pull-request@v7 From dba2bae1b4d2bac0e12b5c0ace2551ebc01f01d1 Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Sat, 28 Jun 2025 07:38:10 +0200 Subject: [PATCH 4/8] chore: fix bump version script (#50) --- scripts/bump-version.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/bump-version.ts b/scripts/bump-version.ts index ac42655d..0f1ba723 100644 --- a/scripts/bump-version.ts +++ b/scripts/bump-version.ts @@ -7,8 +7,11 @@ function getWorkspacePackageJsonFiles(workspaceFile: string): string[] { const workspaceYaml = fs.readFileSync(workspaceFile, 'utf8'); const workspace = yaml.parse(workspaceYaml) as { packages?: string[] }; if (!workspace.packages) throw new Error('No "packages" key found in pnpm-workspace.yaml'); - const rootDir = path.dirname(workspaceFile); + const files = new Set(); + + // include all package.json files in the workspace + const rootDir = path.dirname(workspaceFile); for (const pattern of workspace.packages) { const matches = glob.sync(path.join(pattern, 'package.json'), { cwd: rootDir, @@ -16,6 +19,10 @@ function getWorkspacePackageJsonFiles(workspaceFile: string): string[] { }); matches.filter((f) => !f.includes('node_modules')).forEach((f) => files.add(f)); } + + // include root package.json + files.add(path.resolve(__dirname, '../package.json')); + return Array.from(files); } From c3b41fe754f29e496ea3527bab14047ac3b069dc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Jun 2025 07:52:12 +0200 Subject: [PATCH 5/8] chore: bump version 3.0.0-alpha.6 (#51) Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com> --- package.json | 2 +- packages/cli/package.json | 2 +- packages/common-helpers/package.json | 2 +- packages/create-zenstack/package.json | 2 +- packages/eslint-config/package.json | 2 +- packages/ide/vscode/package.json | 2 +- packages/language/package.json | 2 +- packages/runtime/package.json | 2 +- packages/sdk/package.json | 2 +- packages/tanstack-query/package.json | 2 +- packages/testtools/package.json | 2 +- packages/typescript-config/package.json | 2 +- packages/zod/package.json | 2 +- samples/blog/package.json | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index f516e39e..7e108667 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zenstack-v3", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "description": "ZenStack", "packageManager": "pnpm@10.12.1", "scripts": { diff --git a/packages/cli/package.json b/packages/cli/package.json index bc60529e..1f095ebc 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -3,7 +3,7 @@ "publisher": "zenstack", "displayName": "ZenStack CLI", "description": "FullStack database toolkit with built-in access control and automatic API generation.", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "type": "module", "author": { "name": "ZenStack Team" diff --git a/packages/common-helpers/package.json b/packages/common-helpers/package.json index 028e6e6e..da866f6a 100644 --- a/packages/common-helpers/package.json +++ b/packages/common-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/common-helpers", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "description": "ZenStack Common Helpers", "type": "module", "scripts": { diff --git a/packages/create-zenstack/package.json b/packages/create-zenstack/package.json index 97e262b0..ea1b6143 100644 --- a/packages/create-zenstack/package.json +++ b/packages/create-zenstack/package.json @@ -1,6 +1,6 @@ { "name": "create-zenstack", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "description": "Create a new ZenStack project", "type": "module", "scripts": { diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index b0e1785a..555a07bf 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/eslint-config", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "type": "module", "private": true, "license": "MIT" diff --git a/packages/ide/vscode/package.json b/packages/ide/vscode/package.json index 39d36e80..935a600b 100644 --- a/packages/ide/vscode/package.json +++ b/packages/ide/vscode/package.json @@ -1,7 +1,7 @@ { "name": "zenstack", "publisher": "zenstack", - "version": "3.0.2", + "version": "3.0.3", "displayName": "ZenStack Language Tools", "description": "VSCode extension for ZenStack ZModel language", "private": true, diff --git a/packages/language/package.json b/packages/language/package.json index e8b5f356..d1ef4ed9 100644 --- a/packages/language/package.json +++ b/packages/language/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/language", "description": "ZenStack ZModel language specification", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "license": "MIT", "author": "ZenStack Team", "files": [ diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 3a64c3c7..c9a1d459 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/runtime", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "description": "ZenStack Runtime", "type": "module", "scripts": { diff --git a/packages/sdk/package.json b/packages/sdk/package.json index ff2a5d78..869294d6 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/sdk", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "description": "ZenStack SDK", "type": "module", "scripts": { diff --git a/packages/tanstack-query/package.json b/packages/tanstack-query/package.json index 0671cb13..d093511e 100644 --- a/packages/tanstack-query/package.json +++ b/packages/tanstack-query/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/tanstack-query", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "description": "", "main": "index.js", "type": "module", diff --git a/packages/testtools/package.json b/packages/testtools/package.json index b3fd12ce..7918e2fe 100644 --- a/packages/testtools/package.json +++ b/packages/testtools/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/testtools", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "description": "ZenStack Test Tools", "type": "module", "scripts": { diff --git a/packages/typescript-config/package.json b/packages/typescript-config/package.json index 8e04c3bb..07f149b0 100644 --- a/packages/typescript-config/package.json +++ b/packages/typescript-config/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/typescript-config", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "private": true, "license": "MIT" } diff --git a/packages/zod/package.json b/packages/zod/package.json index 98852b06..0ab2e3d1 100644 --- a/packages/zod/package.json +++ b/packages/zod/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/zod", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "description": "", "type": "module", "main": "index.js", diff --git a/samples/blog/package.json b/samples/blog/package.json index 41fe38f6..a840303f 100644 --- a/samples/blog/package.json +++ b/samples/blog/package.json @@ -1,6 +1,6 @@ { "name": "sample-blog", - "version": "3.0.0-alpha.5", + "version": "3.0.0-alpha.6", "description": "", "main": "index.js", "scripts": { From d55b5361ab81d234b38ef0c27634569189fb8ebc Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Sat, 28 Jun 2025 10:07:10 +0200 Subject: [PATCH 6/8] chore: add publish and release CI workflow (#52) --- .github/workflows/publish-release.yml | 80 +++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/publish-release.yml diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000..20bae73c --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,80 @@ +name: Publish and Release + +on: + workflow_dispatch: + push: + branches: + - main + +permissions: + contents: write + +jobs: + publish-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 10.12.1 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm run build + + - name: Get version from package.json + id: version + run: | + VERSION=$(node -p "require('./package.json').version") + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "tag=v$VERSION" >> $GITHUB_OUTPUT + + - name: Publish packages + run: pnpm run publish-all + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Generate changelog + id: changelog + run: | + PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + + if [ -z "$PREVIOUS_TAG" ]; then + CHANGELOG=$(git log --oneline --no-merges --format="* %s" HEAD) + else + CHANGELOG=$(git log --oneline --no-merges --format="* %s" ${PREVIOUS_TAG}..HEAD) + fi + + if [ -z "$CHANGELOG" ]; then + CHANGELOG="* Automated release" + fi + + echo "changelog<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.version.outputs.tag }} + release_name: Release ${{ steps.version.outputs.tag }} + body: | + ## Changes in this release + + ${{ steps.changelog.outputs.changelog }} + draft: true + prerelease: true From 3d28a93848b4ddc24d708341e4a4f9a6e16da60c Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Sat, 28 Jun 2025 10:52:33 +0200 Subject: [PATCH 7/8] chore: fix bump version script (#54) --- scripts/bump-version.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/bump-version.ts b/scripts/bump-version.ts index 0f1ba723..ff4d353f 100644 --- a/scripts/bump-version.ts +++ b/scripts/bump-version.ts @@ -50,9 +50,8 @@ for (const file of packageFiles) { const content = fs.readFileSync(file, 'utf8'); const pkg = JSON.parse(content) as { version?: string }; if (pkg.version) { - const oldVersion = pkg.version; - const newVersion = incrementVersion(pkg.version); // do a string replace from oldVersion to newVersion + const oldVersion = pkg.version; const newContent = content.replace(`"version": "${oldVersion}"`, `"version": "${newVersion}"`); fs.writeFileSync(file, newContent); console.log(`Updated ${file}: ${oldVersion} -> ${newVersion}`); From 5c3914506e2bec28d2c9c76f21e7418e835c56f5 Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Sat, 28 Jun 2025 11:04:12 +0200 Subject: [PATCH 8/8] chore: fix bump version script (#55) * chore: fix bump version script * update CI script * update --- .github/workflows/publish-release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 20bae73c..0f10a888 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -27,6 +27,7 @@ jobs: with: node-version: 20.x cache: 'pnpm' + registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: pnpm install --frozen-lockfile @@ -66,12 +67,12 @@ jobs: echo "EOF" >> $GITHUB_OUTPUT - name: Create GitHub Release - uses: actions/create-release@v1 + uses: softprops/action-gh-release@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ steps.version.outputs.tag }} - release_name: Release ${{ steps.version.outputs.tag }} + name: ZenStack Release ${{ steps.version.outputs.tag }} body: | ## Changes in this release