Skip to content

Commit eb7c367

Browse files
committed
fix(ci): comprehensive workflow improvements for reliable releases
Summary of changes: 1. Fixed --ignore pattern in ats.release.yml: - Changed from non-existent @hashgraph/mass-payout* to correct @mass-payout/* namespace 2. Simplified publish triggers in ats.publish.yml and mp.publish.yml: - Changed from release.published event to push.tags for automatic publishing - Tag push (v*-ats or v*-mp) now directly triggers publish workflow - No need to manually create GitHub release first 3. Removed recursive publish scripts: - Removed "publish": "npm publish" from contracts and SDK package.json - These caused npm to recursively call itself during publish lifecycle - Root cause of 403 errors and double-publish attempts in CI 4. Updated workflow documentation: - Moved .github/workflows/README.md to .github/WORKFLOWS.md - Updated diagrams and instructions to reflect tag-based triggers - Fixed --ignore patterns in manual release documentation Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
1 parent 9071e73 commit eb7c367

File tree

7 files changed

+81
-47
lines changed

7 files changed

+81
-47
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
"@hashgraph/asset-tokenization-contracts": patch
3+
"@hashgraph/asset-tokenization-sdk": patch
4+
---
5+
6+
fix: CI workflow improvements for reliable releases
7+
8+
1. **Fixed --ignore pattern in ats.release.yml**: Changed from non-existent
9+
`@hashgraph/mass-payout*` to correct `@mass-payout/*` package namespace
10+
11+
2. **Simplified publish trigger in ats.publish.yml**: Changed from
12+
`release: published` to `push.tags` for automatic publishing on tag push
13+
(no need to manually create GitHub release)
14+
15+
3. **Removed recursive publish scripts**: Removed `"publish": "npm publish"`
16+
from contracts and SDK package.json files that caused npm to recursively
17+
call itself during publish lifecycle, resulting in 403 errors in CI
Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ For non-feature changes, add these labels to skip changeset requirement:
9696

9797
### Automatic Publishing
9898

99-
| Workflow | Trigger | Purpose |
100-
| ----------------------- | ------------------- | --------------------------- |
101-
| **ATS Publish** | Release tag `*-ats` | Publish ATS packages to npm |
102-
| **Mass Payout Publish** | Release tag `*-mp` | Publish MP packages to npm |
99+
| Workflow | Trigger | Purpose |
100+
| ----------------------- | ----------------- | --------------------------- |
101+
| **ATS Publish** | Tag push `v*-ats` | Publish ATS packages to npm |
102+
| **Mass Payout Publish** | Tag push `v*-mp` | Publish MP packages to npm |
103103

104104
## Release Process
105105

@@ -121,12 +121,12 @@ sequenceDiagram
121121
122122
Dev->>GH: Trigger ATS Release Workflow
123123
GH->>GH: Validate ATS changesets exist
124-
GH->>M: Run changeset version --ignore MP
125-
GH->>M: Commit version changes to main
126-
GH->>M: Create tag v1.16.0-ats
127-
GH->>GH: Create GitHub release
128-
GH->>NPM: Auto-trigger publish workflow
129-
NPM->>NPM: Publish contracts & SDK
124+
GH->>M: Run changeset version --ignore MP packages
125+
GH->>M: Commit version changes
126+
GH->>M: Push tag v1.16.0-ats
127+
Note over GH,NPM: Tag push auto-triggers publish workflow
128+
GH->>NPM: Publish contracts & SDK
129+
Note over GH: GitHub release created (optional, for notes)
130130
```
131131

132132
#### Mass Payout Release Flow
@@ -140,12 +140,12 @@ sequenceDiagram
140140
141141
Dev->>GH: Trigger MP Release Workflow
142142
GH->>GH: Validate MP changesets exist
143-
GH->>M: Run changeset version --ignore ATS
144-
GH->>M: Commit version changes to main
145-
GH->>M: Create tag v2.4.0-mp
146-
GH->>GH: Create GitHub release
147-
GH->>NPM: Auto-trigger publish workflow
148-
NPM->>NPM: Publish MP packages
143+
GH->>M: Run changeset version --ignore ATS packages
144+
GH->>M: Commit version changes
145+
GH->>M: Push tag v2.4.0-mp
146+
Note over GH,NPM: Tag push auto-triggers publish workflow
147+
GH->>NPM: Publish MP packages
148+
Note over GH: GitHub release created (optional, for notes)
149149
```
150150

151151
#### Release Options
@@ -202,11 +202,17 @@ sequenceDiagram
202202
2. **Apply changesets and version packages**:
203203

204204
```bash
205-
# For ATS release
206-
npx changeset version --ignore "@hashgraph/mass-payout*"
207-
208-
# For Mass Payout release
209-
npx changeset version --ignore "@hashgraph/asset-tokenization-*"
205+
# For ATS release (ignore all Mass Payout packages)
206+
npx changeset version \
207+
--ignore "@mass-payout/contracts" \
208+
--ignore "@mass-payout/sdk" \
209+
--ignore "@mass-payout/backend" \
210+
--ignore "@mass-payout/frontend"
211+
212+
# For Mass Payout release (ignore all ATS packages)
213+
npx changeset version \
214+
--ignore "@hashgraph/asset-tokenization-contracts" \
215+
--ignore "@hashgraph/asset-tokenization-sdk"
210216
```
211217

212218
3. **Commit version changes**:
@@ -221,10 +227,15 @@ sequenceDiagram
221227
- Create PR from `release/v1.22.2-ats` to `main`
222228
- Review and merge the version changes
223229

224-
5. **Create GitHub release**:
225-
- Create tag `v1.22.2-ats` on main branch
226-
- Create GitHub release with generated changelog
227-
- Publishing workflows trigger automatically
230+
5. **Create and push tag**:
231+
232+
```bash
233+
git tag v1.22.2-ats
234+
git push origin v1.22.2-ats
235+
```
236+
237+
- Tag push automatically triggers publish workflow
238+
- Optionally create GitHub release for release notes
228239

229240
6. **Sync main back to develop**:
230241
```bash
@@ -269,11 +280,12 @@ sequenceDiagram
269280
end
270281
271282
Note over M: Ready for release
272-
M->>GH: Manual release trigger
273-
GH->>M: Version packages + create tag
274-
GH->>GH: Create GitHub release
275-
GH->>NPM: Auto-trigger publish
276-
NPM->>NPM: Publish to NPM
283+
M->>GH: Manual release workflow trigger
284+
GH->>M: Version packages
285+
GH->>M: Push tag (e.g., v2.0.0-ats)
286+
Note over GH,NPM: Tag push auto-triggers publish
287+
GH->>NPM: Publish to NPM
288+
Note over GH: GitHub release optional (for notes)
277289
278290
M->>D: Sync version changes back
279291
```

.github/workflows/ats.publish.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ on:
1010
type: boolean
1111
default: false
1212

13-
# Release published trigger (GitHub release creation) - only for ATS releases (tags ending with -ats)
14-
release:
15-
types:
16-
- published
13+
# Tag push trigger - simpler and automatic (no need to create GitHub release)
14+
push:
15+
tags:
16+
- "v*-ats"
17+
- "v*-ATS"
1718

1819
defaults:
1920
run:
@@ -27,8 +28,8 @@ jobs:
2728
contracts:
2829
name: Publish ATS Contracts
2930
runs-on: token-studio-linux-large
30-
# Only run if manual trigger OR release tag contains/ends with '-ats'/'-ATS'
31-
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.ref_name, '-ats-') || endsWith(github.ref_name, '-ats') }}
31+
# Only run if manual trigger OR tag push (already filtered by v*-ats pattern)
32+
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
3233

3334
steps:
3435
- name: Harden Runner
@@ -82,8 +83,8 @@ jobs:
8283
sdk:
8384
name: Publish ATS SDK
8485
runs-on: token-studio-linux-large
85-
# Only run if manual trigger OR release tag contains/ends with '-ats'/'-ATS'
86-
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.ref_name, '-ats-') || endsWith(github.ref_name, '-ats') }}
86+
# Only run if manual trigger OR tag push (already filtered by v*-ats pattern)
87+
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
8788
# needs: contracts # Commented out for parallel execution
8889

8990
steps:

.github/workflows/ats.release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ jobs:
8787
run: |
8888
echo "🚀 Releasing ATS packages only (ignoring Mass Payout packages)"
8989
90-
npx changeset version --ignore "@hashgraph/mass-payout*"
90+
# Ignore all mass-payout packages (they use @mass-payout/* namespace)
91+
npx changeset version \
92+
--ignore "@mass-payout/contracts" \
93+
--ignore "@mass-payout/sdk" \
94+
--ignore "@mass-payout/backend" \
95+
--ignore "@mass-payout/frontend"
9196
9297
if [[ -n "$(git status --porcelain)" ]]; then
9398
echo "✅ Version bump completed for ATS packages"

.github/workflows/mp.publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ on:
1010
type: boolean
1111
default: false
1212

13-
# Release published trigger (GitHub release creation) - only for Mass Payout releases (tags ending with -mp)
14-
release:
15-
types:
16-
- published
13+
# Tag push trigger - simpler and automatic (no need to create GitHub release)
14+
push:
15+
tags:
16+
- "v*-mp"
17+
- "v*-MP"
1718

1819
defaults:
1920
run:
@@ -27,8 +28,8 @@ jobs:
2728
mass-payout:
2829
name: Publish Mass Payout Packages
2930
runs-on: token-studio-linux-large
30-
# Only run if manual trigger OR release tag contains 'mp'
31-
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.ref_name, '-mp') }}
31+
# Only run if manual trigger OR tag push (already filtered by v*-mp pattern)
32+
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
3233

3334
steps:
3435
- name: Harden Runner

packages/ats/contracts/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
"deploy:hedera:mainnet": "NETWORK=hedera-mainnet npm run deploy",
6868
"local:hardhat": "npx hardhat node",
6969
"deploy:hardhat": "npx hardhat run scripts/cli/hardhat.ts",
70-
"publish": "npm publish",
7170
"compile": "npx hardhat compile",
7271
"compile:traces": "npx hardhat --show-stack-traces compile",
7372
"compile:force": "npx hardhat compile --force",

packages/ats/sdk/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"build": "rimraf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && tsc -p tsconfig.cjs.json && tsc-alias -p tsconfig.cjs.json",
2323
"test": "NODE_OPTIONS=--max-old-space-size=16384 npx jest --ci --runInBand --detectOpenHandles --forceExit",
2424
"clean": "npm run clean:build && npm run clean:cache && npm run clean:coverage",
25-
"publish": "npm publish",
2625
"prepack": "npm run build",
2726
"clean:build": "npx --yes rimraf build",
2827
"clean:cache": "npx --yes rimraf cache",

0 commit comments

Comments
 (0)