44 push :
55 tags :
66 - ' v*'
7+ workflow_dispatch :
8+ inputs :
9+ dry_run :
10+ description : ' Dry run mode (test without publishing)'
11+ type : boolean
12+ default : true
713
814jobs :
915 publish :
@@ -31,25 +37,34 @@ jobs:
3137 - name : Extract version from tag
3238 id : extract_version
3339 run : |
34- # Remove 'v' prefix from tag
35- VERSION=${GITHUB_REF_NAME#v}
36- echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
37- echo "📌 Expected version: $VERSION"
38-
39- # Determine npm tag based on version format
40- if [[ "$VERSION" =~ -[0-9]+$ ]]; then
41- NPM_TAG="alpha"
42- echo "🚨 Decorated version detected, using --tag alpha"
40+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
41+ # Manual trigger - use version from package.json
42+ VERSION=$(cd packages/common && node -p "require('./package.json').version")
43+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
44+ echo "NPM_TAG=test" >> $GITHUB_OUTPUT
45+ echo "📌 Manual run - version: $VERSION, tag: test"
4346 else
44- NPM_TAG="latest"
45- echo "✅ Stable version, using --tag latest"
47+ # Tag trigger - extract from tag name
48+ VERSION=${GITHUB_REF_NAME#v}
49+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
50+ echo "📌 Expected version: $VERSION"
51+
52+ # Determine npm tag based on version format
53+ if [[ "$VERSION" =~ -[0-9]+$ ]]; then
54+ NPM_TAG="alpha"
55+ echo "🚨 Decorated version detected, using --tag alpha"
56+ else
57+ NPM_TAG="latest"
58+ echo "✅ Stable version, using --tag latest"
59+ fi
60+ echo "NPM_TAG=$NPM_TAG" >> $GITHUB_OUTPUT
4661 fi
47- echo "NPM_TAG=$NPM_TAG" >> $GITHUB_OUTPUT
4862
4963 - name : Verify package versions match tag
64+ if : github.event_name == 'push'
5065 run : |
5166 VERSION=${{ steps.extract_version.outputs.VERSION }}
52-
67+
5368 # Verify all packages have the correct version
5469 for package in common db common-ui courseware edit-ui client platform-ui standalone-ui express mcp cli; do
5570 PACKAGE_VERSION=$(cd packages/$package && node -p "require('./package.json').version")
5974 fi
6075 echo "✅ packages/$package version $PACKAGE_VERSION matches tag"
6176 done
62-
77+
6378 echo "✅ All package versions verified"
6479
6580 - name : Lint packages
@@ -73,37 +88,37 @@ jobs:
7388 run : |
7489 echo "Building common package..."
7590 yarn workspace @vue-skuilder/common build
76-
91+
7792 echo "Building db package..."
7893 yarn workspace @vue-skuilder/db build
79-
94+
8095 echo "Building common-ui package..."
8196 yarn workspace @vue-skuilder/common-ui build
82-
97+
8398 echo "Building courseware package..."
8499 yarn workspace @vue-skuilder/courseware build
85100
86101 echo "Building edit-ui package..."
87102 yarn workspace @vue-skuilder/edit-ui build
88-
103+
89104 echo "Building client package..."
90105 yarn workspace @vue-skuilder/client build
91-
106+
92107 echo "Building platform-ui package..."
93108 yarn workspace @vue-skuilder/platform-ui build
94-
109+
95110 echo "Building standalone-ui package..."
96111 yarn workspace @vue-skuilder/standalone-ui build
97-
112+
98113 echo "Building express package..."
99114 yarn workspace @vue-skuilder/express build
100-
115+
101116 # echo "Building tuilder package..."
102117 # yarn workspace @vue-skuilder/tuilder build
103-
118+
104119 echo "Building mcp package..."
105120 yarn workspace @vue-skuilder/mcp build
106-
121+
107122 echo "Building cli package..."
108123 yarn workspace @vue-skuilder/cli build
109124
@@ -118,45 +133,46 @@ jobs:
118133 done
119134
120135 - name : Publish packages in dependency order
136+ if : github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false')
121137 run : |
122138 set -e
123139 NPM_TAG="${{ steps.extract_version.outputs.NPM_TAG }}"
124140
125141 echo "Publishing @vue-skuilder/common..."
126- cd packages/common && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
142+ cd packages/common && yarn npm publish --access public --tag $NPM_TAG && cd ../..
127143
128144 echo "Publishing @vue-skuilder/db..."
129- cd packages/db && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
145+ cd packages/db && yarn npm publish --access public --tag $NPM_TAG && cd ../..
130146
131147 echo "Publishing @vue-skuilder/common-ui..."
132- cd packages/common-ui && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
148+ cd packages/common-ui && yarn npm publish --access public --tag $NPM_TAG && cd ../..
133149
134150 echo "Publishing @vue-skuilder/edit-ui..."
135- cd packages/edit-ui && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
151+ cd packages/edit-ui && yarn npm publish --access public --tag $NPM_TAG && cd ../..
136152
137153 echo "Publishing @vue-skuilder/courseware..."
138- cd packages/courseware && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
154+ cd packages/courseware && yarn npm publish --access public --tag $NPM_TAG && cd ../..
139155
140156 echo "Publishing @vue-skuilder/client..."
141- cd packages/client && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
157+ cd packages/client && yarn npm publish --access public --tag $NPM_TAG && cd ../..
142158
143159 echo "Publishing @vue-skuilder/platform-ui..."
144- cd packages/platform-ui && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
160+ cd packages/platform-ui && yarn npm publish --access public --tag $NPM_TAG && cd ../..
145161
146162 echo "Publishing @vue-skuilder/standalone-ui..."
147- cd packages/standalone-ui && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
163+ cd packages/standalone-ui && yarn npm publish --access public --tag $NPM_TAG && cd ../..
148164
149165 echo "Publishing @vue-skuilder/mcp..."
150- cd packages/mcp && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
166+ cd packages/mcp && yarn npm publish --access public --tag $NPM_TAG && cd ../..
151167
152168 # echo "Publishing @vue-skuilder/tuilder..."
153- # cd packages/tuilder && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
169+ # cd packages/tuilder && yarn npm publish --access public --tag $NPM_TAG && cd ../..
154170
155171 echo "Publishing @vue-skuilder/express..."
156- cd packages/express && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
172+ cd packages/express && yarn npm publish --access public --tag $NPM_TAG && cd ../..
157173
158174 echo "Publishing @vue-skuilder/cli (scoped)..."
159- cd packages/cli && yarn npm publish --access public --tag $NPM_TAG --provenance && cd ../..
175+ cd packages/cli && yarn npm publish --access public --tag $NPM_TAG && cd ../..
160176
161177 # Dual-publish CLI as unscoped 'skuilder' package
162178 echo "Publishing CLI as 'skuilder'..."
@@ -173,17 +189,20 @@ jobs:
173189 "
174190
175191 # Use yarn npm publish to maintain workspace dependency resolution
176- yarn npm publish --access public --tag $NPM_TAG --provenance
192+ yarn npm publish --access public --tag $NPM_TAG
177193 cd ../..
178-
179194 echo "All packages published successfully!"
195+ env :
196+ YARN_NPM_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
197+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
180198
181199 - name : NPM publish completed
200+ if : github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false')
182201 run : |
183202 echo "✅ All vue-skuilder packages published to NPM registry"
184203 echo "📦 Packages published:"
185204 echo " - @vue-skuilder/common"
186- echo " - @vue-skuilder/db"
205+ echo " - @vue-skuilder/db"
187206 echo " - @vue-skuilder/common-ui"
188207 echo " - @vue-skuilder/courseware"
189208 echo " - @vue-skuilder/edit-ui"
@@ -195,4 +214,4 @@ jobs:
195214 echo " - @vue-skuilder/cli"
196215 echo " - skuilder (CLI unscoped)"
197216 echo ""
198- echo "🚀 GitHub release will be created by the 'Publish GitHub Release' workflow"
217+ echo "🚀 GitHub release will be created by the 'Publish GitHub Release' workflow"
0 commit comments