Skip to content

Commit da7f893

Browse files
committed
chore: automatic release
1 parent 7fc05c9 commit da7f893

File tree

10 files changed

+1520
-100
lines changed

10 files changed

+1520
-100
lines changed

.github/workflows/release.yml

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ name: Release
22

33
on:
44
push:
5-
tags:
6-
- "v*"
5+
branches:
6+
- main
77
workflow_dispatch:
8+
inputs:
9+
dry-run:
10+
description: "Dry run (no actual release)"
11+
required: false
12+
type: boolean
13+
default: false
814

915
jobs:
10-
publish:
16+
release:
1117
runs-on:
1218
group: databricks-protected-runner-group
1319
labels: linux-ubuntu-latest
@@ -19,29 +25,68 @@ jobs:
1925
id-token: write
2026

2127
steps:
22-
- uses: actions/checkout@v4
23-
- uses: pnpm/action-setup@v4
24-
- uses: actions/setup-node@v4
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Setup Git
35+
run: |
36+
git config user.name "github-actions[bot]"
37+
git config user.email "github-actions[bot]@users.noreply.github.com"
38+
39+
- name: Setup pnpm
40+
uses: pnpm/action-setup@v4
41+
42+
- name: Setup Node.js
43+
uses: actions/setup-node@v4
2544
with:
2645
node-version: 20
2746
registry-url: "https://registry.npmjs.org"
2847
cache: "pnpm"
48+
2949
- name: Update npm
3050
run: npm install -g npm@latest
3151

3252
- name: Install dependencies
3353
run: pnpm install --frozen-lockfile
3454

35-
- name: Build package
36-
run: pnpm run pack:sdk
55+
- name: Build packages
56+
run: pnpm build
3757

38-
- name: Create GitHub Release
39-
uses: softprops/action-gh-release@v1
40-
with:
41-
files: |
42-
*.tgz
43-
draft: false
44-
prerelease: false
58+
# Determine dry-run mode
59+
- name: Set release mode
60+
id: mode
61+
run: |
62+
if [ "${{ github.event_name }}" == "push" ]; then
63+
echo "dry_run=false" >> $GITHUB_OUTPUT
64+
else
65+
echo "dry_run=${{ inputs.dry-run }}" >> $GITHUB_OUTPUT
66+
fi
67+
68+
# Release @databricks/appkit
69+
- name: Release @databricks/appkit
70+
working-directory: packages/appkit
71+
run: |
72+
if [ "${{ steps.mode.outputs.dry_run }}" == "true" ]; then
73+
pnpm exec release-it --ci --dry-run
74+
else
75+
pnpm exec release-it --ci
76+
fi
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4580

46-
- name: Release to NPM
47-
run: pnpm run release
81+
# Release @databricks/appkit-ui
82+
- name: Release @databricks/appkit-ui
83+
working-directory: packages/appkit-ui
84+
run: |
85+
if [ "${{ steps.mode.outputs.dry_run }}" == "true" ]; then
86+
pnpm exec release-it --ci --dry-run
87+
else
88+
pnpm exec release-it --ci
89+
fi
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CLAUDE.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,59 @@ pnpm clean # Remove build artifacts
101101
pnpm clean:full # Remove build artifacts + node_modules
102102
```
103103

104+
### Releasing
105+
106+
This project uses [release-it](https://github.com/release-it/release-it) with [conventional-changelog](https://www.conventionalcommits.org/) for automated releases. Each package (`appkit` and `appkit-ui`) can be released independently.
107+
108+
#### GitHub Actions (Recommended)
109+
110+
Releases are automated via GitHub Actions and trigger in two ways:
111+
112+
**Automatic (on merge to main):**
113+
- When PRs are merged to `main`, the workflow automatically runs
114+
- Analyzes commits since last release using conventional commits
115+
- If there are `feat:` or `fix:` commits, both packages are released together
116+
- If no releasable commits, the release is skipped
117+
118+
**Manual (workflow_dispatch):**
119+
1. Go to **Actions → Release → Run workflow**
120+
2. Optionally enable "Dry run" to preview without publishing
121+
3. Click "Run workflow"
122+
123+
**Required GitHub Secrets:**
124+
- `NPM_TOKEN` - npm automation token for publishing
125+
126+
The workflow automatically:
127+
- Builds all packages
128+
- Bumps version based on conventional commits
129+
- Updates `CHANGELOG.md`
130+
- Creates git tag and GitHub release
131+
- Publishes to npm
132+
133+
#### Local Release (Alternative)
134+
135+
**Prerequisites:**
136+
- Be on `main` branch with a clean working directory
137+
- Set `GITHUB_TOKEN` environment variable
138+
- Be logged in to npm (`npm login`)
139+
140+
```bash
141+
# Dry run (preview what will happen without making changes)
142+
pnpm release:dry # Dry run for both packages
143+
144+
# Interactive release (prompts for version bump)
145+
pnpm release # Release both packages
146+
147+
# CI release (non-interactive, for automation)
148+
pnpm release:ci # Release both packages in CI mode
149+
```
150+
151+
#### Version Bumps (Conventional Commits)
152+
153+
- `feat:` → Minor version bump (0.1.0 → 0.2.0)
154+
- `fix:` → Patch version bump (0.1.0 → 0.1.1)
155+
- `feat!:` or `BREAKING CHANGE:` → Major version bump (0.1.0 → 1.0.0)
156+
104157
## Architecture Overview
105158

106159
### Plugin System

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
"format": "biome format --write .",
2727
"lint:fix": "biome lint --write .",
2828
"lint": "biome lint .",
29-
"pack:sdk": "pnpm build && pnpm -r dist",
29+
"pack:sdk": "pnpm build && pnpm -r tarball",
3030
"prepare": "husky",
31-
"release:dry": "pnpm run pack:sdk && pnpm --filter=@databricks/appkit release:dry && pnpm --filter=@databricks/appkit-ui release:dry",
32-
"release": "pnpm run pack:sdk && pnpm --filter=@databricks/appkit release && pnpm --filter=@databricks/appkit-ui release",
31+
"release": "pnpm build && pnpm --filter=@databricks/appkit release && pnpm --filter=@databricks/appkit-ui release",
32+
"release:dry": "pnpm build && pnpm --filter=@databricks/appkit release:dry && pnpm --filter=@databricks/appkit-ui release:dry",
33+
"release:ci": "pnpm build && pnpm --filter=@databricks/appkit release:ci && pnpm --filter=@databricks/appkit-ui release:ci",
3334
"setup:repo": "./tools/setup.sh",
3435
"start": "NODE_ENV=production pnpm build:sdk && pnpm --filter=sdk-playground build:app && pnpm --filter=sdk-playground start:local",
3536
"test:watch": "vitest",
@@ -46,6 +47,7 @@
4647
"@biomejs/biome": "2.2.6",
4748
"@commitlint/cli": "^19.8.0",
4849
"@commitlint/config-conventional": "^19.8.0",
50+
"@release-it/conventional-changelog": "^10.0.4",
4951
"@testing-library/dom": "^10.4.1",
5052
"@testing-library/react": "^16.3.0",
5153
"@types/node": "^24.7.2",
@@ -54,9 +56,10 @@
5456
"husky": "^9.1.7",
5557
"jsdom": "^27.0.0",
5658
"lint-staged": "^15.5.1",
57-
"plop": "^4.0.4",
5859
"pg": "^8.16.3",
60+
"plop": "^4.0.4",
5961
"publint": "^0.3.15",
62+
"release-it": "^19.1.0",
6063
"tsdown": "^0.15.7",
6164
"tsx": "^4.20.6",
6265
"turbo": "^2.6.1",
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$schema": "https://unpkg.com/release-it@19/schema/release-it.json",
3+
"git": {
4+
"commitMessage": "chore(appkit-ui): release v${version}",
5+
"tagName": "appkit-ui-v${version}",
6+
"tagAnnotation": "Release @databricks/appkit-ui v${version}",
7+
"requireBranch": "main",
8+
"requireCleanWorkingDir": true,
9+
"push": true,
10+
"pushArgs": ["--follow-tags"]
11+
},
12+
"github": {
13+
"release": true,
14+
"releaseName": "@databricks/appkit-ui v${version}",
15+
"autoGenerate": false,
16+
"draft": false,
17+
"preRelease": false,
18+
"tokenRef": "GITHUB_TOKEN"
19+
},
20+
"npm": {
21+
"publish": true,
22+
"publishPath": "./tmp",
23+
"publishArgs": ["--access", "public", "--no-git-checks"],
24+
"skipChecks": true
25+
},
26+
"hooks": {
27+
"before:init": ["pnpm run dist"]
28+
},
29+
"plugins": {
30+
"@release-it/conventional-changelog": {
31+
"preset": {
32+
"name": "conventionalcommits",
33+
"types": [
34+
{ "type": "feat", "section": "Features" },
35+
{ "type": "fix", "section": "Bug Fixes" },
36+
{ "type": "perf", "section": "Performance Improvements" },
37+
{ "type": "refactor", "section": "Code Refactoring" },
38+
{ "type": "docs", "section": "Documentation" },
39+
{ "type": "test", "section": "Tests" },
40+
{ "type": "build", "section": "Build System" },
41+
{ "type": "ci", "section": "Continuous Integration" },
42+
{ "type": "chore", "section": "Chores", "hidden": true }
43+
]
44+
},
45+
"infile": "CHANGELOG.md",
46+
"header": "# Changelog\n\nAll notable changes to @databricks/appkit-ui will be documented in this file."
47+
}
48+
}
49+
}

packages/appkit-ui/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Changelog
2+
3+
All notable changes to @databricks/appkit-ui will be documented in this file.
4+

packages/appkit-ui/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131
"scripts": {
3232
"build:package": "tsdown --config tsdown.config.ts",
3333
"build:watch": "tsdown --config tsdown.config.ts --watch",
34-
"dist": "tsx ../../tools/dist.ts && npm pack ./tmp --pack-destination ./tmp",
35-
"release:dry": "pnpm dist && pnpm publish ./tmp --access public --dry-run --no-git-checks",
36-
"release": "pnpm dist && pnpm publish ./tmp --access public --no-git-checks",
37-
"typecheck": "tsc --noEmit",
34+
"clean:full": "rm -rf dist node_modules tmp",
3835
"clean": "rm -rf dist tmp",
39-
"clean:full": "rm -rf dist node_modules tmp"
36+
"dist": "tsx ../../tools/dist.ts",
37+
"release:ci": "release-it --ci",
38+
"release:dry": "release-it --dry-run",
39+
"release": "release-it",
40+
"tarball": "tsx ../../tools/dist.ts && npm pack ./tmp --pack-destination ./tmp",
41+
"typecheck": "tsc --noEmit"
4042
},
4143
"dependencies": {
4244
"@hookform/resolvers": "^5.2.2",

packages/appkit/.release-it.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$schema": "https://unpkg.com/release-it@19/schema/release-it.json",
3+
"git": {
4+
"commitMessage": "chore(appkit): release v${version}",
5+
"tagName": "appkit-v${version}",
6+
"tagAnnotation": "Release @databricks/appkit v${version}",
7+
"requireBranch": "main",
8+
"requireCleanWorkingDir": true,
9+
"push": true,
10+
"pushArgs": ["--follow-tags"]
11+
},
12+
"github": {
13+
"release": true,
14+
"releaseName": "@databricks/appkit v${version}",
15+
"autoGenerate": false,
16+
"draft": false,
17+
"preRelease": false,
18+
"tokenRef": "GITHUB_TOKEN"
19+
},
20+
"npm": {
21+
"publish": true,
22+
"publishPath": "./tmp",
23+
"publishArgs": ["--access", "public", "--no-git-checks"],
24+
"skipChecks": true
25+
},
26+
"hooks": {
27+
"before:init": ["pnpm run dist"]
28+
},
29+
"plugins": {
30+
"@release-it/conventional-changelog": {
31+
"preset": {
32+
"name": "conventionalcommits",
33+
"types": [
34+
{ "type": "feat", "section": "Features" },
35+
{ "type": "fix", "section": "Bug Fixes" },
36+
{ "type": "perf", "section": "Performance Improvements" },
37+
{ "type": "refactor", "section": "Code Refactoring" },
38+
{ "type": "docs", "section": "Documentation" },
39+
{ "type": "test", "section": "Tests" },
40+
{ "type": "build", "section": "Build System" },
41+
{ "type": "ci", "section": "Continuous Integration" },
42+
{ "type": "chore", "section": "Chores", "hidden": true }
43+
]
44+
},
45+
"infile": "CHANGELOG.md",
46+
"header": "# Changelog\n\nAll notable changes to @databricks/appkit will be documented in this file."
47+
}
48+
}
49+
}

packages/appkit/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Changelog
2+
3+
All notable changes to @databricks/appkit will be documented in this file.
4+

packages/appkit/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@
2828
"scripts": {
2929
"build:package": "tsdown --config tsdown.config.ts",
3030
"build:watch": "tsdown --config tsdown.config.ts --watch",
31-
"typecheck": "tsc --noEmit",
32-
"dist": "tsx ../../tools/dist.ts && npm pack ./tmp --pack-destination ./tmp",
33-
"release:dry": "pnpm run dist && pnpm publish ./tmp --access public --dry-run --no-git-checks",
34-
"release": "pnpm dist && pnpm publish ./tmp --access public --no-git-checks",
31+
"clean:full": "rm -rf dist node_modules tmp",
3532
"clean": "rm -rf dist tmp",
36-
"clean:full": "rm -rf dist node_modules tmp"
33+
"dist": "tsx ../../tools/dist.ts",
34+
"release:ci": "release-it --ci",
35+
"release:dry": "release-it --dry-run",
36+
"release": "release-it",
37+
"tarball": "tsx ../../tools/dist.ts && npm pack ./tmp --pack-destination ./tmp",
38+
"typecheck": "tsc --noEmit"
3739
},
3840
"dependencies": {
3941
"@databricks/sdk-experimental": "^0.15.0",

0 commit comments

Comments
 (0)