Skip to content

Commit b34ec6d

Browse files
chore: 🤖 initial changesets workflow for semver and changelogs (#760)
* chore: 🤖 add changesets pkg * chore: 🤖 track .changeset * chore: 🤖 add changeset:verify to pre-commit hook * chore: 🤖 add changeset verification script * docs: 📝 introduce changeset * docs: 📝 how-to use changeset workflow * docs: fix typo Co-authored-by: Bucky Schwarz <d.w.schwarz@gmail.com> * docs: fix typo Co-authored-by: Bucky Schwarz <d.w.schwarz@gmail.com> --------- Co-authored-by: Bucky Schwarz <d.w.schwarz@gmail.com>
1 parent d10fb42 commit b34ec6d

File tree

7 files changed

+858
-15
lines changed

7 files changed

+858
-15
lines changed

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/deep-wolves-guess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clickhouse/click-ui": patch
3+
---
4+
5+
Introduces a simple workflow to manage versioning and changelogs

.husky/pre-commit

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,13 @@ else
2626
exit 1
2727
fi
2828

29+
if yarn changeset:verify; then
30+
echo "✅ Changeset file's included!"
31+
else
32+
echo "⚠️ WARNING: You must include a changeset!"
33+
echo "💡 Use the command yarn changeset:add"
34+
exit 1
35+
fi
36+
2937
echo "👍 Health check completed."
3038
echo

.scripts/changeset-verification

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
changesetArtifactsRegex="\.changeset/.*\.md$"
4+
5+
pendingChangesetList=$(find .changeset -type f -name "*.md" ! -name "README.md")
6+
7+
if [[ -n "$pendingChangesetList" ]]; then
8+
echo "⚠️ There are pending changeset files:"
9+
echo "$pendingChangesetList"
10+
fi
11+
12+
if ! echo "$pendingChangesetList" | grep -qE "$changesetArtifactsRegex"; then
13+
echo "👹 Oops! Couldn't locate any changeset. Did you forget to include one?"
14+
echo "💡 Run the command yarn changeset:add"
15+
16+
exit 1
17+
fi
18+
19+
echo "✅ Changeset included!"

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,52 @@ function App() {
146146
export default App
147147
```
148148

149+
## Changeset
150+
151+
Learn to manage the versioning of changelog entries.
152+
153+
The following is a brief description of available commands to allow a person making a contribution make key decisions about their changes.
154+
155+
It'll generate a changeset, which is effectively two key bits of information:
156+
157+
- A version type which follows [semver](https://semver.org/)
158+
- Change information placed in a changelog
159+
160+
Make good use of this simple workflow to help us release new package versions more confidently.
161+
162+
### Add a new changeset
163+
164+
When contributing, declare an intent or describe the changes you're making or adding to a release by executing the `changeset:add` command.
165+
166+
The wizard will ask a few questions and generate a changelog entry for you:
167+
168+
```sh
169+
yarn changeset:add
170+
```
171+
172+
The changesets tool keeps track of all declared changes in the `.changeset` directory.
173+
174+
Once completed, you must commit the changeset!
175+
176+
### Checking the changeset status
177+
178+
To check if your branch contains a changeset:
179+
180+
```sh
181+
yarn changeset:status
182+
```
183+
184+
### Create a new version and changelogs
185+
186+
To consume all changesets, and update to the most appropriate semver version and write a friendly changelog based on those changesets, the following command is available:
187+
188+
> [!IMPORTANT]
189+
> Consuming changesets is done automatically in the CI/CD environment. For this reason, you don't have to execute the command, as a contributor your single concern should be adding changesets to any relevant changes.
190+
191+
```sh
192+
yarn changeset:version
193+
```
194+
149195
## Releases and Versions
150196

151197
New versions and release notes are available at [GitHub Releases](https://github.com/ClickHouse/click-ui/releases).

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
"build:bundled": "vite build -- bundled",
3838
"build-storybook": "storybook build",
3939
"build:watch": "watch 'yarn build' ./src",
40+
"changeset:add": "yarn changeset",
41+
"changeset:status": "yarn changeset status",
42+
"changeset:version": "yarn changeset version",
43+
"changeset:verify": ".scripts/changeset-verification",
4044
"chromatic": "yarn dlx chromatic",
4145
"dev": "vite",
4246
"generate-tokens": "node build-tokens.js && prettier --write \"src/theme/tokens/*.ts\" --config .prettierrc",
@@ -80,6 +84,7 @@
8084
"sortablejs": "^1.15.0"
8185
},
8286
"devDependencies": {
87+
"@changesets/cli": "^2.29.8",
8388
"@storybook/addon-a11y": "^10.1.10",
8489
"@storybook/addon-docs": "^10.1.10",
8590
"@storybook/addon-links": "^10.1.10",

0 commit comments

Comments
 (0)