@@ -58,52 +58,13 @@ jobs:
5858 - uses : actions/checkout@v6
5959 - uses : ./.github/actions/setup-node-pnpm
6060 with :
61+ cache : " false"
6162 install : " false"
62-
6363 - name : Check if should publish
6464 id : check
65- run : |
66- check_publish_state() {
67- local package_json_path="$1"
68- local output_key="$2"
69- local version
70- local name
71- local published_version
72-
73- version=$(jq -r '.version' "$package_json_path")
74- name=$(jq -r '.name' "$package_json_path")
75- published_version=$(npm view "${name}@${version}" version --registry "$NPM_REGISTRY_URL" 2>/dev/null || echo "")
76-
77- if [[ "$version" != "$published_version" ]]; then
78- echo "$name@$version is not published to npm, will publish"
79- echo "${output_key}=true" >> "$GITHUB_OUTPUT"
80- return 0
81- fi
82-
83- echo "$name@$version already published to npm, skipping"
84- echo "${output_key}=false" >> "$GITHUB_OUTPUT"
85- return 1
86- }
87-
88- version=$(jq -r '.version' package.json)
89- echo "version=$version" >> "$GITHUB_OUTPUT"
90-
91- cli_needs_publish=false
92- mcp_needs_publish=false
93-
94- if check_publish_state cli/package.json publish_cli; then
95- cli_needs_publish=true
96- fi
97-
98- if check_publish_state mcp/package.json publish_mcp; then
99- mcp_needs_publish=true
100- fi
101-
102- if [[ "$cli_needs_publish" == "true" || "$mcp_needs_publish" == "true" ]]; then
103- echo "publish_npm=true" >> "$GITHUB_OUTPUT"
104- else
105- echo "publish_npm=false" >> "$GITHUB_OUTPUT"
106- fi
65+ uses : ./.github/actions/check-release-state
66+ with :
67+ registry-url : ${{ env.NPM_REGISTRY_URL }}
10768
10869 # 1.5. GUI 版本检查(独立于 npm,检查 GitHub Release)
10970 check-gui-version :
@@ -114,24 +75,11 @@ jobs:
11475 version : ${{ steps.check.outputs.version }}
11576 steps :
11677 - uses : actions/checkout@v6
117-
11878 - name : Check if GUI should be released
11979 id : check
120- env :
121- GH_TOKEN : ${{ github.token }}
122- run : |
123- version=$(jq -r '.version' gui/package.json)
124- echo "GUI version: $version"
125-
126- # Check if this version tag exists on GitHub
127- if gh release view "v${version}" >/dev/null 2>&1; then
128- echo "Release v${version} already exists on GitHub, skipping GUI"
129- echo "should_release=false" >> "$GITHUB_OUTPUT"
130- else
131- echo "Release v${version} does not exist, will build GUI"
132- echo "should_release=true" >> "$GITHUB_OUTPUT"
133- echo "version=$version" >> "$GITHUB_OUTPUT"
134- fi
80+ uses : ./.github/actions/check-gui-release-state
81+ with :
82+ github-token : ${{ github.token }}
13583
13684 # 2. 构建 NAPI 二进制(5 平台矩阵)
13785 build-napi :
0 commit comments