@@ -2,32 +2,115 @@ name: Changesets Publish
22
33on :
44 workflow_dispatch :
5+ inputs :
6+ tag :
7+ description : " Release tag (e.g., latest, experimental, dev)"
8+ required : true
9+ type : string
10+ create_snapshot :
11+ description : " Create snapshot release (when true, uses --snapshot)."
12+ required : true
13+ type : boolean
514
6- concurrency : ${{ github.workflow }}-${{ github.ref }}
15+ concurrency : ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.tag }}
716
817permissions :
918 id-token : write
1019 contents : read
1120
1221jobs :
1322 publish :
14- runs-on : self-hosted-x64
23+ runs-on : ubuntu-latest
1524 steps :
1625 - name : checkout code repository
1726 uses : actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
1827 with :
1928 fetch-depth : 0
29+
2030 - uses : pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
2131 - name : Install Nodejs
2232 uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2333 with :
2434 node-version : " 20"
2535 cache : " pnpm"
36+ registry-url : " https://registry.npmjs.org"
37+
2638 - name : Update npm
2739 run : npm install -g npm@latest
40+
41+ - name : Uninstall yarn # https://github.com/postmanlabs/postman-code-generators/issues/792
42+ run : |
43+ YARN_PATH=$(which yarn || true)
44+ if [ -n "$YARN_PATH" ]; then
45+ echo "Removing Yarn at $YARN_PATH"
46+ sudo rm -f "$YARN_PATH"
47+ fi
48+
2849 - name : Install dependencies
2950 run : pnpm install --frozen-lockfile
51+
52+ - name : Check for pending changesets
53+ id : check-changes
54+ run : |
55+ if [ -n "$(ls -A .changeset/*.md 2>/dev/null | grep -v README.md)" ]; then
56+ echo "has-changes=true" >> $GITHUB_OUTPUT
57+ echo "Found pending changesets:"
58+ ls -1 .changeset/*.md 2>/dev/null | grep -v README.md | head -5
59+ else
60+ echo "has-changes=false" >> $GITHUB_OUTPUT
61+ echo "No pending changesets found"
62+ fi
63+
3064 - name : Build packages
31- run : pnpm turbo run build --filter=./sdk
65+ if : steps.check-changes.outputs.has-changes == 'true'
66+ run : |
67+ pnpm turbo run build --filter=./sdk
68+
69+ - name : Create snapshot versions
70+ if : steps.check-changes.outputs.has-changes == 'true'
71+ run : |
72+ if [ "${{ github.event.inputs.create_snapshot }}" = "true" ]; then
73+ pnpm changeset version --snapshot ${{ github.event.inputs.tag }}
74+ else
75+ pnpm changeset version
76+ fi
77+
3278 - name : Publish packages
33- run : pnpm changeset-publish --no-git-tag
79+ if : steps.check-changes.outputs.has-changes == 'true'
80+ run : |
81+ if [ "${{ github.event.inputs.create_snapshot }}" = "true" ]; then
82+ pnpm changeset publish --snapshot --tag ${{ github.event.inputs.tag }}
83+ else
84+ pnpm changeset publish
85+ fi
86+
87+ - name : Create summary
88+ if : steps.check-changes.outputs.has-changes == 'true'
89+ run : |
90+ echo "## Snapshot Release Summary" >> $GITHUB_STEP_SUMMARY
91+ echo "**Tag:** \`${{ github.event.inputs.tag }}\`" >> $GITHUB_STEP_SUMMARY
92+ echo "**Snapshot:** \`${{ github.event.inputs.create_snapshot }}\`" >> $GITHUB_STEP_SUMMARY
93+ echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
94+ echo "**Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
95+ echo "" >> $GITHUB_STEP_SUMMARY
96+ echo "### Published Packages" >> $GITHUB_STEP_SUMMARY
97+ echo "Check the workflow logs for detailed package versions." >> $GITHUB_STEP_SUMMARY
98+ echo "" >> $GITHUB_STEP_SUMMARY
99+ echo "### Installation" >> $GITHUB_STEP_SUMMARY
100+ if [ "${{ github.event.inputs.create_snapshot }}" = "true" ]; then
101+ echo "Install snapshot packages using:" >> $GITHUB_STEP_SUMMARY
102+ echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
103+ echo "npm install @iota/iota-sdk@${{ github.event.inputs.tag }}" >> $GITHUB_STEP_SUMMARY
104+ echo "npm install @iota/dapp-kit@${{ github.event.inputs.tag }}" >> $GITHUB_STEP_SUMMARY
105+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
106+ else
107+ echo "Published packages are official releases; install via the published versions." >> $GITHUB_STEP_SUMMARY
108+ fi
109+
110+ - name : No changes detected
111+ if : steps.check-changes.outputs.has-changes == 'false'
112+ run : |
113+ echo "## No Pending Changesets" >> $GITHUB_STEP_SUMMARY
114+ echo "No pending changesets found. Snapshot release skipped." >> $GITHUB_STEP_SUMMARY
115+ echo "" >> $GITHUB_STEP_SUMMARY
116+ echo "To create a changeset, run \`pnpm changeset\` and select the packages you want to release."
0 commit comments