Skip to content

Commit 918a4a4

Browse files
committed
feat: implement ATS workflow with manual control and validation
- Replace all.publish.yml with ats.publish.yml focused on contracts and SDK only - Add manual trigger with dry-run capability for testing - Remove dependency between SDK and contracts jobs for parallel execution - Update changeset config to use develop as base branch - Support automatic triggers on version tags and release branches - Implement changeset validation workflow to enforce one changeset per PR - Add bypass labels for docs/chore changes (no-changeset, docs-only, hotfix, chore) - Remove premature CHANGELOG.md files and create proper changeset - Fix .gitignore to allow .github/ tracking for workflows - Resolve changeset validation workflow branch detection issues - Simplify validation logic to avoid monorepo dependency conflicts This establishes a complete develop-first workflow with manual release control, automated changeset validation, and parallel publishing capabilities. Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
1 parent c1f0e8c commit 918a4a4

File tree

9 files changed

+305
-38
lines changed

9 files changed

+305
-38
lines changed

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"linked": [],
1313
"access": "restricted",
14-
"baseBranch": "main",
14+
"baseBranch": "develop",
1515
"updateInternalDependencies": "patch",
1616
"ignore": []
1717
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@hashgraph/asset-tokenization-contracts': minor
3+
'@hashgraph/asset-tokenization-sdk': minor
4+
'@hashgraph/asset-tokenization-dapp': minor
5+
---
6+
7+
Implement ATS-focused publish workflow with manual control and develop-branch strategy
8+
9+
- Add new ats.publish.yml workflow focused on contracts and SDK packages only
10+
- Implement changeset validation workflow to enforce one changeset per PR
11+
- Configure develop-branch strategy for Changesets with manual release control
12+
- Add dry-run capability for testing releases without publishing
13+
- Remove old all.publish.yml workflow and update .gitignore
14+
- Support parallel execution of contracts and SDK publishing jobs
15+
- Update documentation with new workflow requirements and bypass labels
16+
17+
This establishes a proper develop-first workflow with manual release control while ensuring all changes are properly documented through changesets.

.github/workflows/ats.publish.yml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: ATS Publish
2+
3+
on:
4+
# Manual trigger with dry-run option
5+
workflow_dispatch:
6+
inputs:
7+
dry-run-enabled:
8+
description: 'Run npm publish with dry-run flag'
9+
required: false
10+
type: boolean
11+
default: false
12+
ref:
13+
description: 'Branch/tag/commit to publish from'
14+
required: false
15+
type: string
16+
default: 'main'
17+
18+
# Automatic triggers
19+
push:
20+
tags:
21+
- 'v*.*.*' # Version tags
22+
branches:
23+
- 'release/**' # Release branches
24+
25+
# Release published trigger
26+
release:
27+
types:
28+
- published
29+
30+
defaults:
31+
run:
32+
shell: bash
33+
34+
permissions:
35+
contents: read
36+
id-token: write
37+
38+
jobs:
39+
contracts:
40+
name: Publish ATS Contracts
41+
runs-on: token-studio-linux-large
42+
permissions:
43+
contents: read
44+
id-token: write
45+
46+
steps:
47+
- name: Harden Runner
48+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
49+
with:
50+
egress-policy: audit
51+
52+
- name: Checkout repository
53+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
54+
with:
55+
ref: ${{ inputs.ref || github.ref }}
56+
fetch-depth: 0
57+
58+
- name: Setup NodeJS Environment
59+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
60+
with:
61+
node-version: 22.x
62+
registry-url: https://registry.npmjs.org
63+
64+
- name: Create .npmrc file
65+
env:
66+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
67+
run: |
68+
cat << 'EOF' > .npmrc
69+
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
70+
EOF
71+
72+
- name: Install dependencies
73+
run: npm ci
74+
75+
- name: Build ATS Contracts
76+
run: npm run ats:contracts:build
77+
78+
- name: Test ATS Contracts
79+
run: npm run ats:contracts:test
80+
81+
- name: Publish ATS Contracts
82+
env:
83+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
84+
DRY_RUN: ${{ inputs.dry-run-enabled }}
85+
run: |
86+
echo "DRY_RUN is set to: '${DRY_RUN}'"
87+
88+
cd packages/ats/contracts
89+
90+
PUBLISH_ARGS=("--access=restricted")
91+
if [[ "${DRY_RUN}" == "true" ]]; then
92+
PUBLISH_ARGS+=("--dry-run")
93+
echo "🔍 DRY RUN MODE: Would publish @hashgraph/asset-tokenization-contracts"
94+
fi
95+
96+
npm publish "${PUBLISH_ARGS[@]}"
97+
98+
sdk:
99+
name: Publish ATS SDK
100+
runs-on: token-studio-linux-large
101+
# needs: contracts # Commented out for parallel execution
102+
permissions:
103+
contents: read
104+
id-token: write
105+
106+
steps:
107+
- name: Harden Runner
108+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
109+
with:
110+
egress-policy: audit
111+
112+
- name: Checkout repository
113+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
114+
with:
115+
ref: ${{ inputs.ref || github.ref }}
116+
fetch-depth: 0
117+
118+
- name: Setup NodeJS Environment
119+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
120+
with:
121+
node-version: 22.x
122+
registry-url: https://registry.npmjs.org
123+
124+
- name: Create .npmrc file
125+
env:
126+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
127+
run: |
128+
cat << 'EOF' > .npmrc
129+
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
130+
EOF
131+
132+
- name: Install dependencies
133+
run: npm ci
134+
135+
- name: Build ATS Contracts and SDK
136+
run: |
137+
npm run ats:contracts:build
138+
npm run ats:sdk:build
139+
140+
- name: Test ATS SDK
141+
run: npm run ats:sdk:test
142+
143+
- name: Publish ATS SDK
144+
env:
145+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
146+
DRY_RUN: ${{ inputs.dry-run-enabled }}
147+
run: |
148+
echo "DRY_RUN is set to: '${DRY_RUN}'"
149+
150+
cd packages/ats/sdk
151+
152+
PUBLISH_ARGS=("--access=restricted")
153+
if [[ "${DRY_RUN}" == "true" ]]; then
154+
PUBLISH_ARGS+=("--dry-run")
155+
echo "🔍 DRY RUN MODE: Would publish @hashgraph/asset-tokenization-sdk"
156+
fi
157+
158+
npm publish "${PUBLISH_ARGS[@]}"
159+
160+
# Summary job to report results
161+
summary:
162+
name: Publish Summary
163+
runs-on: token-studio-linux-large
164+
needs: [contracts, sdk]
165+
if: always()
166+
steps:
167+
- name: Report Results
168+
run: |
169+
echo "## ATS Publish Results" >> $GITHUB_STEP_SUMMARY
170+
echo "| Package | Status |" >> $GITHUB_STEP_SUMMARY
171+
echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
172+
echo "| Contracts | ${{ needs.contracts.result }} |" >> $GITHUB_STEP_SUMMARY
173+
echo "| SDK | ${{ needs.sdk.result }} |" >> $GITHUB_STEP_SUMMARY
174+
175+
if [[ "${{ inputs.dry-run-enabled }}" == "true" ]]; then
176+
echo "" >> $GITHUB_STEP_SUMMARY
177+
echo "🔍 **DRY RUN MODE** - No packages were actually published" >> $GITHUB_STEP_SUMMARY
178+
fi
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Changeset Check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
- labeled
12+
- unlabeled
13+
14+
permissions:
15+
contents: read
16+
pull-requests: read
17+
18+
jobs:
19+
check-changeset:
20+
name: Validate Changeset Required
21+
runs-on: token-studio-linux-large
22+
23+
steps:
24+
- name: Harden Runner
25+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
26+
with:
27+
egress-policy: audit
28+
29+
- name: Checkout repository
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
fetch-depth: 0
33+
# Ensure we have the develop branch for comparison
34+
ref: ${{ github.head_ref }}
35+
36+
- name: Fetch develop branch
37+
run: |
38+
# Ensure we have the develop branch for changesets comparison
39+
git fetch origin develop:develop || git fetch origin main:develop || true
40+
git branch -a
41+
42+
- name: Setup NodeJS Environment
43+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
44+
with:
45+
node-version: 22.x
46+
47+
- name: Check for bypass labels
48+
id: bypass
49+
run: |
50+
# Check if PR has bypass labels
51+
LABELS=$(gh pr view ${{ github.event.number }} --json labels --jq '.labels[].name' || echo "")
52+
53+
if echo "$LABELS" | grep -E "(no-changeset|docs-only|hotfix|chore)" > /dev/null; then
54+
echo "bypass=true" >> $GITHUB_OUTPUT
55+
echo "✅ Found bypass label. Skipping changeset check."
56+
else
57+
echo "bypass=false" >> $GITHUB_OUTPUT
58+
echo "🔍 No bypass labels found. Changeset check required."
59+
fi
60+
env:
61+
GH_TOKEN: ${{ github.token }}
62+
63+
- name: Install dependencies
64+
if: steps.bypass.outputs.bypass == 'false'
65+
run: npm ci
66+
67+
- name: Check changeset status
68+
if: steps.bypass.outputs.bypass == 'false'
69+
run: |
70+
echo "🔍 Checking for required changesets..."
71+
72+
# Check if we have any changeset files first
73+
CHANGESET_FILES=$(find .changeset -name "*.md" -not -name "README.md" | wc -l)
74+
echo "Found $CHANGESET_FILES changeset files"
75+
76+
if [ "$CHANGESET_FILES" -gt 0 ]; then
77+
echo "✅ Changeset validation passed - found changeset files"
78+
else
79+
echo ""
80+
echo "❌ CHANGESET REQUIRED"
81+
echo ""
82+
echo "This PR requires a changeset to document the changes."
83+
echo ""
84+
echo "To create a changeset:"
85+
echo "1. Run: npm run changeset"
86+
echo "2. Select the packages that changed"
87+
echo "3. Choose the change type (patch/minor/major)"
88+
echo "4. Write a description of your changes"
89+
echo "5. Commit the generated .changeset/*.md file"
90+
echo ""
91+
echo "To bypass this check (for docs/chore changes only):"
92+
echo "Add one of these labels to the PR:"
93+
echo "- no-changeset: For pure documentation or config changes"
94+
echo "- docs-only: For documentation-only changes"
95+
echo "- chore: For build system or dependency updates"
96+
echo "- hotfix: For emergency fixes"
97+
echo ""
98+
echo "More info: https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md"
99+
exit 1
100+
fi
101+
102+
- name: Success summary
103+
if: always()
104+
run: |
105+
if [ "${{ steps.bypass.outputs.bypass }}" = "true" ]; then
106+
echo "✅ Changeset check bypassed due to label"
107+
else
108+
echo "✅ Changeset validation completed successfully"
109+
fi

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ dist
117117

118118
# Stores VSCode versions used for testing VSCode extensions
119119
.vscode-test
120-
.github/
121120

122121
# Mac files
123122
.DS_Store

apps/ats/web/CHANGELOG.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/ats/contracts/CHANGELOG.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/ats/sdk/CHANGELOG.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)