mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
feat: add version tracking infrastructure
Add VERSION file, versions-matrix.json, and .changesets/ directory. Enables changeset-based versioning workflow where developers create changeset files when modifying contracts, which accumulate until release.
This commit is contained in:
parent
7e429de111
commit
b99a7f90ee
5 changed files with 106 additions and 0 deletions
83
contracts/.changesets/README.md
Normal file
83
contracts/.changesets/README.md
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
# Changesets
|
||||
|
||||
This directory contains version bump declarations for contract changes.
|
||||
|
||||
## How It Works
|
||||
|
||||
When you modify contracts in `contracts/src/`, you must declare a version bump by running:
|
||||
|
||||
```bash
|
||||
bun cli contracts bump --type [major|minor|patch] --description "Optional description"
|
||||
```
|
||||
|
||||
This creates a file like `pr-123.txt` (or `bump-{timestamp}.txt` if not in a PR) containing:
|
||||
- First line: The bump type
|
||||
- Subsequent lines: Optional description of the changes
|
||||
|
||||
## Release Workflow
|
||||
|
||||
1. **Development**: Developers create changesets for their contract changes
|
||||
2. **Before Release**: Manually trigger the "Contracts Versioning" GitHub Action
|
||||
3. **PR Creation**: The action creates a PR with:
|
||||
- Updated `VERSION` file
|
||||
- Updated `versions-matrix.json`
|
||||
- All changeset descriptions in PR body
|
||||
- Deleted changeset files
|
||||
4. **Contract Upgrade**: Checkout the PR branch and run `bun cli contracts upgrade`
|
||||
5. **Merge**: Merge the PR to main after upgrade completes
|
||||
|
||||
## Example Workflow
|
||||
|
||||
```bash
|
||||
# 1. Make contract changes
|
||||
vim contracts/src/DataHavenServiceManager.sol
|
||||
|
||||
# 2. Declare version bump with description
|
||||
bun cli contracts bump --type minor --description "Add support for custom validator rewards"
|
||||
|
||||
# 3. Commit the changeset file
|
||||
git add contracts/.changesets/
|
||||
git commit -m "feat: add custom validator rewards"
|
||||
|
||||
# 4. Push PR - CI validates changeset exists
|
||||
git push origin feature-branch
|
||||
|
||||
# 5. On merge to main, changesets accumulate
|
||||
|
||||
# 6. Before release, manually run GitHub Action "Contracts Versioning"
|
||||
|
||||
# 7. Action creates PR with version bump
|
||||
|
||||
# 8. Checkout PR and upgrade contracts
|
||||
git checkout release/version-X.Y.Z
|
||||
bun cli contracts upgrade --chain hoodi
|
||||
|
||||
# 9. Merge PR to main
|
||||
```
|
||||
|
||||
## File Format
|
||||
|
||||
Each changeset file contains:
|
||||
- **Line 1**: Bump type (`major`, `minor`, or `patch`)
|
||||
- **Lines 2+**: Optional description of changes
|
||||
|
||||
Example `pr-123.txt`:
|
||||
```
|
||||
minor
|
||||
Add support for custom validator rewards distribution.
|
||||
This allows operators to configure reward multipliers per validator.
|
||||
```
|
||||
|
||||
## Version Bump Rules
|
||||
|
||||
- `major` - Breaking changes (X.0.0)
|
||||
- `minor` - New features, backwards compatible (0.X.0)
|
||||
- `patch` - Bug fixes, backwards compatible (0.0.X)
|
||||
|
||||
## Aggregation Rules
|
||||
|
||||
- One or more changeset files per PR
|
||||
- CI fails if contracts changed but no changeset exists
|
||||
- Multiple changesets are consolidated by taking the highest bump type
|
||||
- **Multiple major bumps are aggregated into a single major version bump**
|
||||
- Changesets are deleted after processing (clean main branch)
|
||||
1
contracts/.changesets/pr-195.txt
Normal file
1
contracts/.changesets/pr-195.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
patch
|
||||
4
contracts/.gitignore
vendored
4
contracts/.gitignore
vendored
|
|
@ -13,3 +13,7 @@ docs/
|
|||
|
||||
# Local CLAUDE configuration
|
||||
CLAUDE.local.md
|
||||
|
||||
# Changesets - track changeset files but not .gitkeep
|
||||
# Empty .gitkeep is only needed for directory tracking
|
||||
.changesets/.gitkeep
|
||||
|
|
|
|||
1
contracts/VERSION
Normal file
1
contracts/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
1.1.1
|
||||
17
contracts/versions-matrix.json
Normal file
17
contracts/versions-matrix.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"code": {
|
||||
"version": "1.1.1",
|
||||
"checksum": "2b642ee7ac050226e05369845732014d8d7349ea",
|
||||
"lastModified": "2026-02-06T19:54:59.232Z"
|
||||
},
|
||||
"deployments": {
|
||||
"anvil": {
|
||||
"version": "1.1.0",
|
||||
"lastDeployed": "2026-02-06T19:49:51.230Z"
|
||||
},
|
||||
"hoodi": {
|
||||
"version": "1.0.0",
|
||||
"lastDeployed": "2026-02-05T18:06:00Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue