Skip to content

Commit 8ae83d6

Browse files
Copilothotlong
andcommitted
Add comprehensive changeset setup documentation
- Create CHANGESET_SETUP.md with detailed guide on changeset workflow - Document how to use changesets for contributors - Explain automated release process for maintainers - Include troubleshooting and example changesets Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 7af9b7e commit 8ae83d6

File tree

1 file changed

+200
-0
lines changed

1 file changed

+200
-0
lines changed

CHANGESET_SETUP.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Changeset and Automated Release Setup
2+
3+
## Overview
4+
5+
This document describes the changeset-based automated release workflow that has been set up for the Object UI monorepo.
6+
7+
## What Changed
8+
9+
### 1. Dependencies
10+
- Added `@changesets/cli` as a development dependency
11+
- Configured changesets for the monorepo structure
12+
13+
### 2. Configuration Files
14+
- **`.changeset/config.json`**: Changeset configuration
15+
- Set to public access for npm packages
16+
- Ignores example and app packages
17+
- Configured for `main` as the base branch
18+
19+
- **`.changeset/README.md`**: Enhanced documentation for changeset usage
20+
21+
### 3. Package Scripts
22+
Added the following scripts to `package.json`:
23+
- `pnpm changeset`: Create a new changeset
24+
- `pnpm changeset:version`: Bump versions based on changesets
25+
- `pnpm changeset:publish`: Publish packages to npm
26+
27+
### 4. GitHub Actions Workflows
28+
29+
#### `changeset-release.yml`
30+
- **Trigger**: Push to `main` branch
31+
- **Purpose**: Automates version bumping and package publishing
32+
- **Process**:
33+
1. Detects changesets in merged PRs
34+
2. Creates/updates a "Version Packages" PR
35+
3. When merged, publishes to npm and creates GitHub releases
36+
37+
#### `changeset-check.yml`
38+
- **Trigger**: Pull requests
39+
- **Purpose**: Ensures PRs include changesets when modifying packages
40+
- **Behavior**:
41+
- Checks for changeset files when packages are modified
42+
- Fails if no changeset found
43+
- Can be bypassed with `skip-changeset` label
44+
45+
### 5. Documentation Updates
46+
- **CONTRIBUTING.md**: Added comprehensive section on version management
47+
- **.github/WORKFLOWS.md**: Documented the new workflows
48+
- **.changeset/README.md**: Object UI-specific changeset guide
49+
50+
## How to Use
51+
52+
### For Contributors
53+
54+
#### Making Changes to Packages
55+
56+
1. **Make your code changes**
57+
```bash
58+
# Edit files in packages/
59+
```
60+
61+
2. **Create a changeset**
62+
```bash
63+
pnpm changeset
64+
```
65+
66+
3. **Follow the prompts**:
67+
- Select which packages changed
68+
- Choose version bump type (major/minor/patch)
69+
- Write a description of the changes
70+
71+
4. **Commit the changeset**
72+
```bash
73+
git add .changeset/*.md
74+
git commit -m "feat: add new feature"
75+
```
76+
77+
5. **Create PR**
78+
- Your PR will now include the changeset
79+
- The changeset-check workflow will pass
80+
81+
#### When You Don't Need a Changeset
82+
83+
If your PR doesn't modify package code (e.g., docs only, examples, tests), add the `skip-changeset` label to bypass the check.
84+
85+
### For Maintainers
86+
87+
#### Publishing a Release
88+
89+
1. **Merge PRs with changesets**
90+
- Contributors create PRs with changesets
91+
- Merge them to `main` after review
92+
93+
2. **Review the Version PR**
94+
- The changeset-release workflow automatically creates a "Version Packages" PR
95+
- This PR updates version numbers and CHANGELOGs
96+
- Review the changes
97+
98+
3. **Merge the Version PR**
99+
- When you merge it, packages are automatically published to npm
100+
- GitHub releases are created with tags
101+
102+
#### Emergency Manual Release
103+
104+
If needed, you can manually bump versions and publish:
105+
106+
```bash
107+
# Bump versions
108+
pnpm changeset:version
109+
110+
# Review changes
111+
git diff
112+
113+
# Commit
114+
git add .
115+
git commit -m "chore: release packages"
116+
117+
# Build
118+
pnpm build
119+
120+
# Publish
121+
pnpm changeset:publish
122+
```
123+
124+
## Required Secrets
125+
126+
For automated publishing to work, ensure the following secrets are configured in GitHub repository settings:
127+
128+
- `NPM_TOKEN`: npm authentication token with publish permissions
129+
130+
## Benefits
131+
132+
1. **Automated Version Management**: No manual version number editing
133+
2. **Comprehensive Changelogs**: Auto-generated from changeset descriptions
134+
3. **Coordinated Releases**: All packages updated together correctly
135+
4. **Semantic Versioning**: Enforced through changeset type selection
136+
5. **Clear History**: Each release has a dedicated PR for review
137+
6. **Reduced Errors**: Eliminates manual version conflicts and mistakes
138+
139+
## Semantic Versioning Guide
140+
141+
Choose the appropriate version bump type:
142+
143+
- **Patch (0.0.x)**: Bug fixes, minor improvements
144+
- Example: "Fix validation error in form component"
145+
146+
- **Minor (0.x.0)**: New features (backwards compatible)
147+
- Example: "Add DatePicker component"
148+
149+
- **Major (x.0.0)**: Breaking changes
150+
- Example: "Remove deprecated API methods"
151+
152+
## Troubleshooting
153+
154+
### Changeset check failing but I have a changeset
155+
156+
Ensure:
157+
1. The changeset file is in `.changeset/` directory
158+
2. It's named `*.md` (not `README.md`)
159+
3. It follows the correct format (see examples in `.changeset/`)
160+
161+
### Version PR not created
162+
163+
Check:
164+
1. Changesets exist in `.changeset/` directory
165+
2. The changeset-release workflow ran successfully
166+
3. GitHub Actions has proper permissions
167+
168+
### Publishing failed
169+
170+
Verify:
171+
1. `NPM_TOKEN` secret is set correctly
172+
2. Token has publish permissions
173+
3. Package names are available on npm
174+
4. All tests and builds pass
175+
176+
## Example Changeset
177+
178+
Here's what a changeset file looks like:
179+
180+
```markdown
181+
---
182+
"@object-ui/react": minor
183+
"@object-ui/components": patch
184+
---
185+
186+
Add support for custom validation rules in form components
187+
188+
This change introduces a new `validators` prop that allows developers to define custom validation logic for form fields. The components package is updated to use these validators in the form renderer.
189+
```
190+
191+
## Resources
192+
193+
- [Changesets Documentation](https://github.com/changesets/changesets)
194+
- [Contributing Guide](../CONTRIBUTING.md#versioning-and-releases)
195+
- [Workflows Documentation](../.github/WORKFLOWS.md)
196+
- [Semantic Versioning](https://semver.org/)
197+
198+
---
199+
200+
For questions or issues with the changeset workflow, please open a GitHub issue or discussion.

0 commit comments

Comments
 (0)