-
Notifications
You must be signed in to change notification settings - Fork 26
fix: fix auto publish error #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,8 @@ jobs: | |
| # 步骤2: 设置pnpm包管理器 | ||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9 | ||
|
|
||
| # 步骤3: 设置Node.js环境 | ||
| - name: Setup Node | ||
|
|
@@ -78,31 +80,46 @@ jobs: | |
| fi | ||
| echo "version: $VERSION" | ||
| echo "value=$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build lib | ||
| - name: Bump version | ||
| run: | | ||
| # pnpm 自带 npm 版本管理 | ||
| pnpm version ${{ steps.ver.outputs.value }} --no-git-tag-version | ||
| # 显示确认 | ||
| cat package.json | jq .version | ||
| - name: Build | ||
| run: pnpm build | ||
| - name: Clean node_modules | ||
| run: | | ||
| # 删除任何意外混进去的 node_modules | ||
| ls | ||
| rm -rf node_modules | ||
| find template -type d -name node_modules -prune -exec rm -rf {} + | ||
| # 生成待发布 tarball(验证用) | ||
| npm pack --dry-run | ||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist-artifact | ||
| path: dist/ | ||
| path: ./ | ||
| # Publish job | ||
|
Comment on lines
+91
to
104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n .github/workflows/dispatch-publish.yml | sed -n '85,125p'Repository: opentiny/tiny-pro Length of output: 1667 🏁 Script executed: cat package.json | jq '.files // "No files field"'Repository: opentiny/tiny-pro Length of output: 77 Minimize artifact scope: Uploading the entire repository to
🤖 Prompt for AI Agents |
||
| publish: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| registry-url: https://registry.npmjs.org | ||
| - name: Download build artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist-artifact | ||
| path: dist/ | ||
| path: ./ | ||
| - name: Show version and tag | ||
| run: | | ||
| echo "publish version: ${{ needs.build.outputs.version }}" | ||
| echo "publish tag: ${{ inputs.tag }}" | ||
|
|
||
| # 步骤8: 发布组件到NPM | ||
| - name: Publish @opentiny/fluent-editor | ||
| - name: Publish @opentiny/tiny-toolkit-pro | ||
| run: | | ||
| echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc | ||
| npm publish --tag ${{ inputs.tag }} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: opentiny/tiny-pro
Length of output: 3914
🏁 Script executed:
Repository: opentiny/tiny-pro
Length of output: 676
Avoid uploading the entire repo (
path: ./) as an artifact.Using
path: ./at lines 58 and 72 uploads/downloads the entire repository unnecessarily. Even withnode_modulescleaned, this still includes source files,.githistory,.githubworkflows, and other files unneeded for npm publishing. Upload only the minimal publish set:dist/**,package.json,README*, andLICENSE*. For the download step, use a dedicated folder likepath: artifact/to avoid cluttering the working directory.🤖 Prompt for AI Agents