|
| 1 | +# GitHub Workflows Documentation |
| 2 | + |
| 3 | +This document explains the CI/CD system for the Asset Tokenization Studio (ATS) monorepo, including development workflow, release processes, and how to work with changesets. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The repository uses **Changesets** for version management with independent release cycles for: |
| 8 | + |
| 9 | +- **ATS Project**: Asset Tokenization Studio (contracts, SDK, web app) |
| 10 | +- **Mass Payout Project**: Mass payout functionality |
| 11 | + |
| 12 | +All development happens on the `develop` branch with automated testing, changeset validation, and manual release controls by authorized teams. |
| 13 | + |
| 14 | +## How to test github workflows locally |
| 15 | + |
| 16 | +To be able to test github workflows locally you can use act, a github actions simulator [act homepage](https://nektosact.com/introduction.html) |
| 17 | + |
| 18 | +### Install act |
| 19 | + |
| 20 | +```bash |
| 21 | +curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash |
| 22 | +``` |
| 23 | + |
| 24 | +### Run workflow |
| 25 | + |
| 26 | +Substitute \<workflow\> for the workflow you want to test (ats.pubilsh, mp.release, ...) |
| 27 | + |
| 28 | +```bash |
| 29 | +./bin/act workflow_dispatch \ |
| 30 | + -W .github/workflows/<workflow>.yml \ |
| 31 | + --input dry-run-enabled=true \ |
| 32 | + -s NPM_TOKEN=fake_token \ |
| 33 | + -P token-studio-linux-large=catthehacker/ubuntu:act-latest |
| 34 | +``` |
| 35 | + |
| 36 | +## Developer Workflow |
| 37 | + |
| 38 | +### Daily Development Process |
| 39 | + |
| 40 | +```mermaid |
| 41 | +sequenceDiagram |
| 42 | + participant D as develop |
| 43 | + participant F as feature/branch |
| 44 | + participant M as main |
| 45 | + participant F1 as feature/branch-main |
| 46 | +
|
| 47 | + Note over D,M: Daily Development Pattern |
| 48 | +
|
| 49 | + D->>F: Create feature branch |
| 50 | + Note over F: Code changes + changeset |
| 51 | + F->>D: PR with changeset (tests + validation) |
| 52 | + Note over D: Accumulate features |
| 53 | +
|
| 54 | + D->>F1: Create branch from develop |
| 55 | + Note over F1: Same changes (no changeset needed) |
| 56 | + F1->>M: PR to main (ready for release) |
| 57 | + Note over M: Production-ready code |
| 58 | +``` |
| 59 | + |
| 60 | +### Step-by-Step Guide |
| 61 | + |
| 62 | +1. **Create feature branch from develop**: |
| 63 | + |
| 64 | + ```bash |
| 65 | + git checkout develop && git pull origin develop |
| 66 | + git checkout -b feature/your-feature-name |
| 67 | + ``` |
| 68 | + |
| 69 | +2. **Make your changes** to ATS or Mass Payout packages |
| 70 | + |
| 71 | +3. **Create changeset** (required for all PRs): |
| 72 | + |
| 73 | + ```bash |
| 74 | + npm run changeset |
| 75 | + ``` |
| 76 | + |
| 77 | + - Select affected packages |
| 78 | + - Choose change type (patch/minor/major) |
| 79 | + - Write clear description |
| 80 | + |
| 81 | +4. **Commit with DCO and Signature compliance**: |
| 82 | + |
| 83 | +Commit messages should comply with the [conventional commits standard](https://www.conventionalcommits.org/en/v1.0.0/) |
| 84 | + |
| 85 | +```bash |
| 86 | +git add . |
| 87 | +git commit --signoff -S -m "feat: your commit message" |
| 88 | +git push origin feature/your-feature-name |
| 89 | +``` |
| 90 | + |
| 91 | +5. **Open PR to develop branch** - automated checks will run |
| 92 | + |
| 93 | +### Bypass Changeset Validation |
| 94 | + |
| 95 | +For non-feature changes, add these labels to skip changeset requirement: |
| 96 | + |
| 97 | +- `no-changeset`: Configuration or documentation changes |
| 98 | +- `docs-only`: Documentation-only changes |
| 99 | +- `chore`: Build system or dependency updates |
| 100 | +- `hotfix`: Emergency fixes |
| 101 | + |
| 102 | +## Workflow Reference |
| 103 | + |
| 104 | +### Automated Workflows |
| 105 | + |
| 106 | +| Workflow | Trigger | Purpose | |
| 107 | +| --------------------- | ---------------------------- | ------------------------------------- | |
| 108 | +| **ATS Tests** | PR to main, ATS file changes | Run ATS contracts, SDK, and web tests | |
| 109 | +| **Mass Payout Tests** | PR to main, MP file changes | Run Mass Payout package tests | |
| 110 | +| **Changeset Check** | PR to develop | Validate changeset or bypass labels | |
| 111 | + |
| 112 | +### Manual Release Workflows |
| 113 | + |
| 114 | +| Workflow | Purpose | Authorized Teams | |
| 115 | +| ----------------------- | ------------------------------------ | ------------------------------------------------------------ | |
| 116 | +| **ATS Release** | Version ATS packages, create release | platform-ci, release-engineering-managers, iobuilders-hedera | |
| 117 | +| **Mass Payout Release** | Version MP packages, create release | platform-ci, release-engineering-managers, iobuilders-hedera | |
| 118 | + |
| 119 | +### Automatic Publishing |
| 120 | + |
| 121 | +| Workflow | Trigger | Purpose | |
| 122 | +| ----------------------- | ------------------- | --------------------------- | |
| 123 | +| **ATS Publish** | Release tag `*-ats` | Publish ATS packages to npm | |
| 124 | +| **Mass Payout Publish** | Release tag `*-mp` | Publish MP packages to npm | |
| 125 | + |
| 126 | +## Release Process |
| 127 | + |
| 128 | +The repository supports **two release approaches**: |
| 129 | + |
| 130 | +1. **Automated Release Workflows** (recommended for most releases) |
| 131 | +2. **Manual Release Branches** (alternative for complex releases or when automation is unavailable) |
| 132 | + |
| 133 | +### Option 1: Automated Release Workflows |
| 134 | + |
| 135 | +#### ATS Release Flow |
| 136 | + |
| 137 | +```mermaid |
| 138 | +sequenceDiagram |
| 139 | + participant Dev as Developer |
| 140 | + participant M as main |
| 141 | + participant GH as GitHub Actions |
| 142 | + participant NPM as NPM Registry |
| 143 | +
|
| 144 | + Dev->>GH: Trigger ATS Release Workflow |
| 145 | + GH->>GH: Validate ATS changesets exist |
| 146 | + GH->>M: Run changeset version --ignore MP |
| 147 | + GH->>M: Commit version changes to main |
| 148 | + GH->>M: Create tag v1.16.0-ats |
| 149 | + GH->>GH: Create GitHub release |
| 150 | + GH->>NPM: Auto-trigger publish workflow |
| 151 | + NPM->>NPM: Publish contracts & SDK |
| 152 | +``` |
| 153 | + |
| 154 | +#### Mass Payout Release Flow |
| 155 | + |
| 156 | +```mermaid |
| 157 | +sequenceDiagram |
| 158 | + participant Dev as Developer |
| 159 | + participant M as main |
| 160 | + participant GH as GitHub Actions |
| 161 | + participant NPM as NPM Registry |
| 162 | +
|
| 163 | + Dev->>GH: Trigger MP Release Workflow |
| 164 | + GH->>GH: Validate MP changesets exist |
| 165 | + GH->>M: Run changeset version --ignore ATS |
| 166 | + GH->>M: Commit version changes to main |
| 167 | + GH->>M: Create tag v2.4.0-mp |
| 168 | + GH->>GH: Create GitHub release |
| 169 | + GH->>NPM: Auto-trigger publish workflow |
| 170 | + NPM->>NPM: Publish MP packages |
| 171 | +``` |
| 172 | + |
| 173 | +#### Release Options |
| 174 | + |
| 175 | +Both automated workflows support: |
| 176 | + |
| 177 | +- **Preview Mode**: Shows what would be released (dry-run) |
| 178 | +- **Release Mode**: Actually creates releases and triggers publishing |
| 179 | + |
| 180 | +### Option 2: Manual Release Branches |
| 181 | + |
| 182 | +For complex releases or when automation is unavailable, you can use the traditional manual release branch approach: |
| 183 | + |
| 184 | +```mermaid |
| 185 | +sequenceDiagram |
| 186 | + participant M as main |
| 187 | + participant D as develop |
| 188 | + participant F as feat/example |
| 189 | + participant F1 as feat/example-main |
| 190 | + participant R as release/v1.22.2-ats |
| 191 | +
|
| 192 | + Note over M,D: Initial state |
| 193 | +
|
| 194 | + loop for each feature in sprint |
| 195 | + D->>F: Create feature branch |
| 196 | + Note over F: Feature development + changeset |
| 197 | + F->>D: Merge PR with changeset |
| 198 | +
|
| 199 | + D->>F1: Create branch from develop |
| 200 | + F1->>M: Merge PR directly to main |
| 201 | + end |
| 202 | +
|
| 203 | + M->>R: Create release branch |
| 204 | + Note over R: Run: npx changeset version |
| 205 | + Note over R: Generate changelogs + version bump |
| 206 | + R->>M: Merge version commit to main |
| 207 | +
|
| 208 | + Note over M: Create tag v1.22.2-ats |
| 209 | + Note over M: Manual GitHub release |
| 210 | + Note over M: Automatic NPM publish via workflow |
| 211 | +
|
| 212 | + M->>D: Merge main back to develop |
| 213 | +``` |
| 214 | + |
| 215 | +#### Manual Release Steps |
| 216 | + |
| 217 | +1. **Create release branch from main**: |
| 218 | + |
| 219 | + ```bash |
| 220 | + git checkout main && git pull origin main |
| 221 | + git checkout -b release/v1.22.2-ats |
| 222 | + ``` |
| 223 | + |
| 224 | +2. **Apply changesets and version packages**: |
| 225 | + |
| 226 | + ```bash |
| 227 | + # For ATS release |
| 228 | + npx changeset version --ignore "@hashgraph/mass-payout*" |
| 229 | + |
| 230 | + # For Mass Payout release |
| 231 | + npx changeset version --ignore "@hashgraph/asset-tokenization-*" |
| 232 | + ``` |
| 233 | + |
| 234 | +3. **Commit version changes**: |
| 235 | + |
| 236 | + ```bash |
| 237 | + git add . |
| 238 | + git commit --signoff -S -m "chore: release v1.22.2-ats" |
| 239 | + git push origin release/v1.22.2-ats |
| 240 | + ``` |
| 241 | + |
| 242 | +4. **Merge release branch to main**: |
| 243 | + - Create PR from `release/v1.22.2-ats` to `main` |
| 244 | + - Review and merge the version changes |
| 245 | + |
| 246 | +5. **Create GitHub release**: |
| 247 | + - Create tag `v1.22.2-ats` on main branch |
| 248 | + - Create GitHub release with generated changelog |
| 249 | + - Publishing workflows trigger automatically |
| 250 | + |
| 251 | +6. **Sync main back to develop**: |
| 252 | + ```bash |
| 253 | + git checkout develop |
| 254 | + git merge main |
| 255 | + git push origin develop |
| 256 | + ``` |
| 257 | + |
| 258 | +**Benefits of Manual Release Branches**: |
| 259 | + |
| 260 | +- ✅ Full control over version timing and content |
| 261 | +- ✅ Ability to make additional changes during release process |
| 262 | +- ✅ Works with existing automated publishing workflows |
| 263 | +- ✅ Suitable for complex releases requiring manual intervention |
| 264 | + |
| 265 | +### Release Authorization |
| 266 | + |
| 267 | +Only these teams can trigger releases: |
| 268 | + |
| 269 | +- `platform-ci` |
| 270 | +- `platform-ci-committers` |
| 271 | +- `release-engineering-managers` |
| 272 | +- `developer-advocates` |
| 273 | +- `iobuilders-hedera` |
| 274 | +- Users containing `hashgraph` |
| 275 | + |
| 276 | +## Workflow Interactions |
| 277 | + |
| 278 | +```mermaid |
| 279 | +sequenceDiagram |
| 280 | + participant D as develop |
| 281 | + participant M as main |
| 282 | + participant GH as GitHub Actions |
| 283 | + participant NPM as NPM Registry |
| 284 | +
|
| 285 | + Note over D,M: Workflow Overview |
| 286 | +
|
| 287 | + loop Feature Development |
| 288 | + Note over D: Features merge to develop |
| 289 | + Note over D: Changesets accumulate |
| 290 | + D->>M: Feature PRs to main |
| 291 | + end |
| 292 | +
|
| 293 | + Note over M: Ready for release |
| 294 | + M->>GH: Manual release trigger |
| 295 | + GH->>M: Version packages + create tag |
| 296 | + GH->>GH: Create GitHub release |
| 297 | + GH->>NPM: Auto-trigger publish |
| 298 | + NPM->>NPM: Publish to NPM |
| 299 | +
|
| 300 | + M->>D: Sync version changes back |
| 301 | +``` |
| 302 | + |
| 303 | +## Troubleshooting |
| 304 | + |
| 305 | +### Common Issues |
| 306 | + |
| 307 | +**❌ Changeset check failed** |
| 308 | + |
| 309 | +- **Solution**: Create changeset with `npm run changeset` or add bypass label |
| 310 | + |
| 311 | +**❌ "No changesets found to be bumped"** |
| 312 | + |
| 313 | +- **Solution**: Ensure changesets exist for the project you're releasing |
| 314 | +- Use `npm run changeset:status` to check pending changes |
| 315 | + |
| 316 | +**❌ Release workflow unauthorized** |
| 317 | + |
| 318 | +- **Solution**: Ensure you're member of authorized teams listed in CODEOWNERS |
| 319 | + |
| 320 | +**❌ Tests failing on PR** |
| 321 | + |
| 322 | +- **Solution**: Run `npm run ats:test` or `npm run mass-payout:test` locally |
| 323 | +- Fix failing tests before requesting review |
| 324 | + |
| 325 | +**❌ DCO check failed** |
| 326 | + |
| 327 | +- **Solution**: Ensure all commits use `--signoff` flag: |
| 328 | + ```bash |
| 329 | + git commit --signoff -S -m "your message" |
| 330 | + ``` |
| 331 | + |
| 332 | +### Getting Help |
| 333 | + |
| 334 | +- **Changesets documentation**: [Changesets Intro](https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md) |
| 335 | +- **Check pending releases**: `npm run changeset:status` |
| 336 | +- **Preview releases**: `npm run release:preview` |
| 337 | +- **Local development**: See `CLAUDE.md` for complete development setup |
| 338 | + |
| 339 | +## Quick Commands |
| 340 | + |
| 341 | +```bash |
| 342 | +# Development |
| 343 | +npm run changeset # Create changeset |
| 344 | +npm run changeset:status # Check pending changes |
| 345 | +npm run ats:test # Run ATS tests |
| 346 | +npm run mass-payout:test # Run MP tests |
| 347 | + |
| 348 | +# Preview releases |
| 349 | +npm run release:preview # Show all pending releases |
| 350 | +npm run release:ats # Preview ATS release (local) |
| 351 | +npm run release:mp # Preview MP release (local) |
| 352 | +``` |
0 commit comments