3434 - name : Install dependencies
3535 run : yarn install --immutable
3636
37- - name : Extract version info
37+ - name : Extract version from tag
3838 id : extract_version
3939 run : |
4040 if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
4747 # Tag trigger - extract from tag name
4848 VERSION=${GITHUB_REF_NAME#v}
4949 echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
50+ echo "📌 Expected version: $VERSION"
5051
52+ # Determine npm tag based on version format
5153 if [[ "$VERSION" =~ -[0-9]+$ ]]; then
5254 NPM_TAG="alpha"
5355 echo "🚨 Decorated version detected, using --tag alpha"
@@ -58,53 +60,158 @@ jobs:
5860 echo "NPM_TAG=$NPM_TAG" >> $GITHUB_OUTPUT
5961 fi
6062
61- - name : Build common package (test)
63+ - name : Verify package versions match tag
64+ if : github.event_name == 'push'
6265 run : |
63- echo "Building @vue-skuilder/common..."
64- yarn workspace @vue-skuilder/common build
66+ VERSION=${{ steps.extract_version.outputs.VERSION }}
67+
68+ # Verify all packages have the correct version
69+ for package in common db common-ui courseware edit-ui client platform-ui standalone-ui express mcp cli; do
70+ PACKAGE_VERSION=$(cd packages/$package && node -p "require('./package.json').version")
71+ if [ "$PACKAGE_VERSION" != "$VERSION" ]; then
72+ echo "❌ Version mismatch in packages/$package: expected $VERSION, found $PACKAGE_VERSION"
73+ exit 1
74+ fi
75+ echo "✅ packages/$package version $PACKAGE_VERSION matches tag"
76+ done
6577
66- - name : Verify build output
67- run : |
68- if [ ! -d "packages/common/dist" ]; then
69- echo "❌ Error: dist directory not found for @vue-skuilder/common"
70- exit 1
71- fi
72- echo "✅ @vue-skuilder/common build output verified"
78+ echo "✅ All package versions verified"
7379
74- - name : Debug environment
80+ - name : Lint packages
7581 run : |
76- echo "NODE_AUTH_TOKEN is set: ${{ secrets.NPM_TOKEN != '' }}"
77- echo "Working directory: $(pwd)"
78- echo "Yarn version: $(yarn --version)"
79- cd packages/common
80- echo "Package version: $(node -p "require('./package.json').version")"
81- echo "Package name: $(node -p "require('./package.json').name")"
82-
83- - name : Test publish (dry run)
84- if : github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true'
82+ yarn workspace @vue-skuilder/common lint:check
83+ yarn workspace @vue-skuilder/db lint:check
84+ yarn workspace @vue-skuilder/express lint:check
85+ yarn workspace @vue-skuilder/cli lint:check
86+
87+ - name : Build packages in dependency order
8588 run : |
86- NPM_TAG="${{ steps.extract_version.outputs.NPM_TAG }}"
89+ echo "Building common package..."
90+ yarn workspace @vue-skuilder/common build
8791
88- echo "Testing publish of @vue-skuilder/common with --dry-run..."
89- cd packages/common
90- yarn npm publish --access public --tag $NPM_TAG --dry-run
92+ echo "Building db package..."
93+ yarn workspace @vue-skuilder/db build
9194
92- echo "✅ Dry run successful!"
93- echo "To publish for real, re-run workflow with dry_run=false"
94- env :
95- YARN_NPM_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
96- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
95+ echo "Building common-ui package..."
96+ yarn workspace @vue-skuilder/common-ui build
97+
98+ echo "Building courseware package..."
99+ yarn workspace @vue-skuilder/courseware build
100+
101+ echo "Building edit-ui package..."
102+ yarn workspace @vue-skuilder/edit-ui build
103+
104+ echo "Building client package..."
105+ yarn workspace @vue-skuilder/client build
106+
107+ echo "Building platform-ui package..."
108+ yarn workspace @vue-skuilder/platform-ui build
109+
110+ echo "Building standalone-ui package..."
111+ yarn workspace @vue-skuilder/standalone-ui build
112+
113+ echo "Building express package..."
114+ yarn workspace @vue-skuilder/express build
115+
116+ # echo "Building tuilder package..."
117+ # yarn workspace @vue-skuilder/tuilder build
118+
119+ echo "Building mcp package..."
120+ yarn workspace @vue-skuilder/mcp build
121+
122+ echo "Building cli package..."
123+ yarn workspace @vue-skuilder/cli build
124+
125+ - name : Verify build outputs
126+ run : |
127+ for package in common db common-ui courseware edit-ui client platform-ui standalone-ui express mcp cli; do
128+ if [ ! -d "packages/$package/dist" ]; then
129+ echo "Error: dist directory not found for @vue-skuilder/$package"
130+ exit 1
131+ fi
132+ echo "✓ @vue-skuilder/$package build output verified"
133+ done
97134
98- - name : Publish common package (REAL)
135+ - name : Publish packages in dependency order
99136 if : github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false')
100137 run : |
138+ set -e
101139 NPM_TAG="${{ steps.extract_version.outputs.NPM_TAG }}"
102140
103141 echo "Publishing @vue-skuilder/common..."
104- cd packages/common
105- yarn npm publish --access public --tag $NPM_TAG
142+ cd packages/common && yarn npm publish --access public --tag $NPM_TAG && cd ../..
143+
144+ echo "Publishing @vue-skuilder/db..."
145+ cd packages/db && yarn npm publish --access public --tag $NPM_TAG && cd ../..
146+
147+ echo "Publishing @vue-skuilder/common-ui..."
148+ cd packages/common-ui && yarn npm publish --access public --tag $NPM_TAG && cd ../..
149+
150+ echo "Publishing @vue-skuilder/edit-ui..."
151+ cd packages/edit-ui && yarn npm publish --access public --tag $NPM_TAG && cd ../..
152+
153+ echo "Publishing @vue-skuilder/courseware..."
154+ cd packages/courseware && yarn npm publish --access public --tag $NPM_TAG && cd ../..
155+
156+ echo "Publishing @vue-skuilder/client..."
157+ cd packages/client && yarn npm publish --access public --tag $NPM_TAG && cd ../..
158+
159+ echo "Publishing @vue-skuilder/platform-ui..."
160+ cd packages/platform-ui && yarn npm publish --access public --tag $NPM_TAG && cd ../..
161+
162+ echo "Publishing @vue-skuilder/standalone-ui..."
163+ cd packages/standalone-ui && yarn npm publish --access public --tag $NPM_TAG && cd ../..
106164
107- echo "✅ Published @vue-skuilder/common"
165+ echo "Publishing @vue-skuilder/mcp..."
166+ cd packages/mcp && yarn npm publish --access public --tag $NPM_TAG && cd ../..
167+
168+ # echo "Publishing @vue-skuilder/tuilder..."
169+ # cd packages/tuilder && yarn npm publish --access public --tag $NPM_TAG && cd ../..
170+
171+ echo "Publishing @vue-skuilder/express..."
172+ cd packages/express && yarn npm publish --access public --tag $NPM_TAG && cd ../..
173+
174+ echo "Publishing @vue-skuilder/cli (scoped)..."
175+ cd packages/cli && yarn npm publish --access public --tag $NPM_TAG && cd ../..
176+
177+ # Dual-publish CLI as unscoped 'skuilder' package
178+ echo "Publishing CLI as 'skuilder'..."
179+ cd packages/cli
180+
181+ # Modify package.json for unscoped publish
182+ node -e "
183+ const fs = require('fs');
184+ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
185+ pkg.name = 'skuilder';
186+ pkg.description = 'CLI tool for scaffolding Skuilder course applications';
187+ delete pkg.publishConfig;
188+ fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
189+ "
190+
191+ # Use yarn npm publish to maintain workspace dependency resolution
192+ yarn npm publish --access public --tag $NPM_TAG
193+ cd ../..
194+ echo "All packages published successfully!"
108195 env :
109196 YARN_NPM_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
110197 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
198+
199+ - name : NPM publish completed
200+ if : github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false')
201+ run : |
202+ echo "✅ All vue-skuilder packages published to NPM registry"
203+ echo "📦 Packages published:"
204+ echo " - @vue-skuilder/common"
205+ echo " - @vue-skuilder/db"
206+ echo " - @vue-skuilder/common-ui"
207+ echo " - @vue-skuilder/courseware"
208+ echo " - @vue-skuilder/edit-ui"
209+ echo " - @vue-skuilder/client"
210+ echo " - @vue-skuilder/platform-ui"
211+ echo " - @vue-skuilder/standalone-ui"
212+ echo " - @vue-skuilder/express"
213+ echo " - @vue-skuilder/mcp"
214+ echo " - @vue-skuilder/cli"
215+ echo " - skuilder (CLI unscoped)"
216+ echo ""
217+ echo "🚀 GitHub release will be created by the 'Publish GitHub Release' workflow"
0 commit comments