Skip to content

Commit b637623

Browse files
committed
feat: migrate Changesets functionality from main to develop branch
- Add Changesets configuration for semantic versioning and automated releases - Update all package versions to 1.16.1 (aligned with develop branch) - Create initial CHANGELOG.md files for all ATS packages - Update GitHub Actions workflow for changesets automation with Node.js 22.x - Configure fixed versioning for ATS packages, independent versioning for mass-payout - Add all changeset management scripts to root package.json - Update documentation for new version management workflow This establishes the foundation for automated version management using Changesets while maintaining compatibility with the develop branch codebase. Migrated from origin/feat/changesets (commit 93ce464) with conflict resolution and version alignment to preserve develop branch state. Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
1 parent 284118a commit b637623

File tree

10 files changed

+1103
-176
lines changed

10 files changed

+1103
-176
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [
6+
[
7+
"@hashgraph/asset-tokenization-contracts",
8+
"@hashgraph/asset-tokenization-sdk",
9+
"@hashgraph/asset-tokenization-dapp"
10+
]
11+
],
12+
"linked": [],
13+
"access": "restricted",
14+
"baseBranch": "main",
15+
"updateInternalDependencies": "patch",
16+
"ignore": []
17+
}

.github/workflows/all.publish.yml

Lines changed: 64 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
11
name: Publishing
22

3-
43
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types:
9+
- closed
10+
branches:
11+
- main
512
release:
6-
types: [published]
7-
13+
types:
14+
- published
815

916
permissions:
10-
contents: read
17+
contents: write
18+
pull-requests: write
19+
id-token: write
1120

1221
jobs:
13-
publish:
14-
name: Publish NPM Packages
15-
runs-on: ubuntu-latest
22+
release:
23+
name: Release with Changesets
24+
runs-on: token-studio-linux-large
25+
# Only run for direct pushes to main OR merged PRs to main
26+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
1627
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1730
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1831

1932
steps:
@@ -24,25 +37,57 @@ jobs:
2437

2538
- name: Checkout repository
2639
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+
with:
41+
fetch-depth: 0
2742

2843
- name: Setup NodeJS Environment
2944
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
3045
with:
31-
node-version: 20.x
46+
node-version: 22.x
47+
registry-url: https://registry.npmjs.org
3248

3349
- name: Install dependencies
3450
run: npm ci
3551

36-
# --- ATS publishing ---
37-
- name: Publish ats/contracts
38-
if: contains(github.ref_name, 'ats')
39-
run: npm run ats:contracts:publish
52+
- name: Build packages
53+
run: npm run ats:build
54+
55+
- name: Create Release Pull Request or Publish
56+
uses: changesets/action@v1
57+
with:
58+
version: npm run changeset:version
59+
publish: npm run changeset:publish
60+
title: 'chore: release packages'
61+
commit: 'chore: release packages'
62+
63+
# Legacy manual release workflow (emergency fallback only)
64+
manual-publish:
65+
name: Manual Publish (Emergency)
66+
runs-on: token-studio-linux-large
67+
if: github.event_name == 'release' && github.event.action == 'published'
68+
env:
69+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
70+
71+
steps:
72+
- name: Harden Runner
73+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
74+
with:
75+
egress-policy: audit
76+
77+
- name: Checkout repository
78+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
79+
80+
- name: Setup NodeJS Environment
81+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
82+
with:
83+
node-version: 22.x
84+
registry-url: https://registry.npmjs.org
85+
86+
- name: Install dependencies
87+
run: npm ci
4088

41-
- name: Publish ats/sdk
42-
if: contains(github.ref_name, 'ats')
43-
run: npm run ats:sdk:publish
89+
- name: Build packages
90+
run: npm run ats:build
4491

45-
# --- Mass Payout publishing ---
46-
- name: Publish mass-payout
47-
if: contains(github.ref_name, 'mp')
48-
run: npm run mass-payout:publish
92+
- name: Publish packages directly
93+
run: npm run ats:publish

README.md

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,11 @@ npm run ats:test:ci # Run CI tests
121121
npm run ats:start # Build contracts/SDK and start web dev server
122122
npm run ats:web:dev # Start web dev server only
123123

124-
# Publishing (for maintainers)
125-
npm run ats:publish # Publish contracts and SDK to npm
124+
# Version management and publishing
125+
npm run changeset # Create changeset for new changes
126+
npm run changeset:version # Update versions based on changesets
127+
npm run changeset:publish # Publish updated packages to npm
128+
npm run release # Build all components and publish
126129
```
127130

128131
### Mass Payout (Placeholder)
@@ -338,13 +341,70 @@ npm run clean:deps
338341
npm ci
339342
```
340343

344+
## Version Management
345+
346+
The project uses **Changesets** for semantic versioning and automated release management.
347+
348+
### Version Strategy
349+
350+
- **ATS packages** (contracts, SDK, web): Use **fixed versioning** - all packages share the same version and are released together
351+
- **Mass-payout packages**: Use **independent versioning** - versioned separately from ATS
352+
353+
### Changeset Workflow
354+
355+
For developers making changes:
356+
357+
1. **Make your changes** to any package
358+
2. **Create a changeset** describing your changes:
359+
360+
```bash
361+
npm run changeset
362+
```
363+
364+
This creates a changeset file describing what changed and the type of change (patch/minor/major)
365+
366+
3. **Commit both** your code changes and the changeset file:
367+
```bash
368+
git add .
369+
git commit -m "feat: add new functionality"
370+
```
371+
372+
For maintainers releasing versions:
373+
374+
1. **Review pending changes**:
375+
376+
```bash
377+
npm run changeset:status
378+
```
379+
380+
2. **Update versions** (consumes changesets and updates package versions):
381+
382+
```bash
383+
npm run changeset:version
384+
git commit -m "chore: release version x.x.x"
385+
```
386+
387+
3. **Build and publish** packages:
388+
```bash
389+
npm run release
390+
```
391+
392+
### Automated Releases
393+
394+
The GitHub Actions workflow automatically:
395+
396+
- Creates "Release PRs" when changesets are pending
397+
- Publishes packages when Release PRs are merged
398+
- Generates changelogs from changeset descriptions
399+
- Creates GitHub releases with proper release notes
400+
341401
## Continuous Integration
342402

343403
The project uses separate GitHub Actions workflows for different components:
344404

345-
- **ATS Tests** (`.github/workflows/test-ats.yml`): Runs when ATS-related files change
346-
- **Mass Payout Tests** (`.github/workflows/test-mp.yml`): Runs when Mass Payout files change
347-
- **Publishing** (`.github/workflows/publish.yml`): Handles publishing to npm with conditional logic based on release tags
405+
- **ATS Tests** (`.github/workflows/ats.test.yml`): Runs when ATS-related files change
406+
- **Mass Payout Tests** (`.github/workflows/mp.test.yml`): Runs when Mass Payout files change
407+
- **Publishing** (`.github/workflows/all.publish.yml`): Automated releases using Changesets
348408

349409
Tests are automatically triggered only when relevant files are modified, improving CI efficiency.
350410

apps/ats/web/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# @hashgraph/asset-tokenization-dapp
2+
3+
## 1.16.1
4+
5+
### Patch Changes
6+
7+
- Initial setup of Changesets for version management
8+
9+
This changeset establishes the baseline for the new version management system using Changesets. All ATS packages are now aligned to version 1.16.1 and will be managed together using fixed versioning.
10+
11+
Mass-payout packages will continue to be versioned independently.

docs/dev-monorepo-migration.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ The Asset Tokenization Studio has been restructured into a proper npm workspaces
6666
| Test web | `cd web && npm test` | `npm run ats:web:test` |
6767
| Test all | Manual in each directory | `npm run ats:test` |
6868

69+
### Version Management Commands
70+
71+
| Task | Old Command | New Command |
72+
| ----------------------- | -------------------------- | ------------------------------------------------- |
73+
| Update package versions | `./changeVersion.sh 1.0.0` | `npm run changeset``npm run changeset:version` |
74+
| Publish packages | Manual npm publish | `npm run changeset:publish` |
75+
| Build and publish | Multiple manual steps | `npm run release` |
76+
6977
### Environment Setup
7078

7179
**Before:**
@@ -122,6 +130,8 @@ If you have custom scripts or CI/CD configurations, update them to use the new w
122130
3. **Better CI/CD**: Path-based test triggers and conditional publishing
123131
4. **Scalability**: Ready for additional packages (e.g., mass-payout)
124132
5. **Consistent Tooling**: Centralized linting and formatting configurations ensure code quality consistency across all packages
133+
6. **Modern Version Management**: Changesets provide automated semantic versioning, changelog generation, and release management
134+
7. **Enterprise-Grade Releases**: Automated release workflows with proper audit trails and documentation
125135

126136
## Troubleshooting
127137

@@ -142,6 +152,19 @@ npm run ats:web:build
142152
**Issue**: Environment variables not working
143153
**Solution**: Check that your `.env` file is in `apps/ats/web/.env`
144154

155+
**Issue**: Version management with old script
156+
**Solution**: The `changeVersion.sh` script has been replaced by Changesets:
157+
158+
```bash
159+
# Old way (deprecated)
160+
./changeVersion.sh 1.0.0
161+
162+
# New way
163+
npm run changeset # Create changeset for changes
164+
npm run changeset:version # Update package versions
165+
npm run release # Build and publish
166+
```
167+
145168
### Getting Help
146169

147170
If you encounter issues during migration:

0 commit comments

Comments
 (0)