@@ -3,14 +3,6 @@ name: Release
33on :
44 workflow_dispatch :
55 inputs :
6- version :
7- description : ' Version bump type'
8- required : true
9- type : choice
10- options :
11- - patch
12- - minor
13- - major
146 dry_run :
157 description : ' Dry run (no publish)'
168 required : false
@@ -55,27 +47,34 @@ jobs:
5547 - name : Run tests
5648 run : pnpm test
5749
58- - name : Bump version
59- run : |
60- # Bump version in all packages
61- pnpm -r exec -- npm version ${{ inputs.version }} --no-git-tag-version
62-
63- # Also bump root package.json
64- npm version ${{ inputs.version }} --no-git-tag-version
65-
66- - name : Get new version
50+ - name : Get version
6751 id : version
6852 run : |
6953 VERSION=$(node -p "require('./package.json').version")
7054 echo "version=$VERSION" >> $GITHUB_OUTPUT
55+ echo "Publishing version: $VERSION"
56+
57+ - name : Check version consistency
58+ run : |
59+ ROOT_VERSION=$(node -p "require('./package.json').version")
60+ SDK_VERSION=$(node -p "require('./packages/sdk/package.json').version")
61+ X402_VERSION=$(node -p "require('./packages/x402/package.json').version")
62+
63+ echo "Root version: $ROOT_VERSION"
64+ echo "SDK version: $SDK_VERSION"
65+ echo "x402 version: $X402_VERSION"
7166
72- - name : Commit version bump
67+ if [ "$ROOT_VERSION" != "$SDK_VERSION" ] || [ "$ROOT_VERSION" != "$X402_VERSION" ]; then
68+ echo "::error::Version mismatch! All package.json files must have the same version."
69+ echo "Please run: npm version <patch|minor|major>"
70+ exit 1
71+ fi
72+
73+ - name : Create git tag
7374 if : ${{ !inputs.dry_run }}
7475 run : |
75- git add .
76- git commit -m "chore: release v${{ steps.version.outputs.version }}"
7776 git tag "v${{ steps.version.outputs.version }}"
78- git push origin main --tags
77+ git push origin "v${{ steps.version.outputs.version }}"
7978
8079 - name : Configure npm for Trusted Publishing
8180 run : |
@@ -108,8 +107,13 @@ jobs:
108107 run : |
109108 echo "## Dry Run Summary" >> $GITHUB_STEP_SUMMARY
110109 echo "" >> $GITHUB_STEP_SUMMARY
111- echo "Would have released version : **v${{ steps.version.outputs.version }}**" >> $GITHUB_STEP_SUMMARY
110+ echo "Current version in package.json : **v${{ steps.version.outputs.version }}**" >> $GITHUB_STEP_SUMMARY
112111 echo "" >> $GITHUB_STEP_SUMMARY
113- echo "### Packages " >> $GITHUB_STEP_SUMMARY
112+ echo "### Would publish: " >> $GITHUB_STEP_SUMMARY
114113 echo "- @moneymq/sdk@${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
115114 echo "- @moneymq/x402@${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
115+ echo "" >> $GITHUB_STEP_SUMMARY
116+ echo "### To release:" >> $GITHUB_STEP_SUMMARY
117+ echo "1. Bump version: \`npm version patch\` (auto-syncs to all packages)" >> $GITHUB_STEP_SUMMARY
118+ echo "2. Push: \`git push && git push --tags\`" >> $GITHUB_STEP_SUMMARY
119+ echo "3. Run this workflow again with dry_run disabled" >> $GITHUB_STEP_SUMMARY
0 commit comments