Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/actions/check-gui-release-state/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check GUI Release State
description: Check whether the current GUI version already has a GitHub release tag

inputs:
github-token:
description: GitHub token used for release lookups
required: true

outputs:
version:
description: GUI version from gui/package.json
value: ${{ steps.check.outputs.version }}
should_release:
description: Whether the GUI version still needs a GitHub release
value: ${{ steps.check.outputs.should_release }}

runs:
using: composite
steps:
- name: Check GUI release state
id: check
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: |
version=$(jq -r '.version' gui/package.json)
echo "GUI version: $version"

if gh release view "v${version}" >/dev/null 2>&1; then
echo "Release v${version} already exists on GitHub, skipping GUI"
echo "should_release=false" >> "$GITHUB_OUTPUT"
else
echo "Release v${version} does not exist, will build GUI"
echo "should_release=true" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
fi
73 changes: 73 additions & 0 deletions .github/actions/check-release-state/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Check Release State
description: Check whether CLI and MCP package versions are already published to npm

inputs:
registry-url:
description: npm registry URL used for publish-state checks
required: false
default: "https://registry.npmjs.org/"

outputs:
version:
description: Workspace version from the repository root package.json
value: ${{ steps.check.outputs.version }}
publish_cli:
description: Whether the CLI package should be published
value: ${{ steps.check.outputs.publish_cli }}
publish_mcp:
description: Whether the MCP package should be published
value: ${{ steps.check.outputs.publish_mcp }}
publish_npm:
description: Whether any npm package should be published
value: ${{ steps.check.outputs.publish_npm }}

runs:
using: composite
steps:
- name: Check npm publish state
id: check
shell: bash
env:
NPM_REGISTRY_URL: ${{ inputs.registry-url }}
run: |
check_publish_state() {
local package_json_path="$1"
local output_key="$2"
local version
local name
local published_version

version=$(jq -r '.version' "$package_json_path")
name=$(jq -r '.name' "$package_json_path")
published_version=$(npm view "${name}@${version}" version --registry "$NPM_REGISTRY_URL" 2>/dev/null || echo "")

if [[ "$version" != "$published_version" ]]; then
echo "$name@$version is not published to npm, will publish"
echo "${output_key}=true" >> "$GITHUB_OUTPUT"
return 0
fi

echo "$name@$version already published to npm, skipping"
echo "${output_key}=false" >> "$GITHUB_OUTPUT"
return 1
}

version=$(jq -r '.version' package.json)
echo "version=$version" >> "$GITHUB_OUTPUT"

cli_needs_publish=false
mcp_needs_publish=false

if check_publish_state cli/package.json publish_cli; then
cli_needs_publish=true
fi

if check_publish_state mcp/package.json publish_mcp; then
mcp_needs_publish=true
fi

if [[ "$cli_needs_publish" == "true" || "$mcp_needs_publish" == "true" ]]; then
echo "publish_npm=true" >> "$GITHUB_OUTPUT"
else
echo "publish_npm=false" >> "$GITHUB_OUTPUT"
fi
15 changes: 14 additions & 1 deletion .github/actions/setup-node-pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ inputs:
description: Optional npm registry URL to configure for npm publish/auth steps
required: false
default: ""
cache:
description: Whether to enable actions/setup-node pnpm cache
required: false
default: "true"
install:
description: Whether to run pnpm install
required: false
Expand All @@ -31,14 +35,23 @@ runs:
with:
version: ${{ inputs.pnpm-version }}

- name: Setup Node
- name: Setup Node with pnpm cache
if: inputs.cache == 'true'
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
registry-url: ${{ inputs.registry-url }}

- name: Setup Node without pnpm cache
if: inputs.cache != 'true'
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}
package-manager-cache: false
registry-url: ${{ inputs.registry-url }}

- name: Install workspace dependencies
if: inputs.install == 'true' && inputs['install-filter'] == ''
shell: bash
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,35 @@ concurrency:
cancel-in-progress: true

jobs:
release-preflight:
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v6

- uses: ./.github/actions/setup-node-pnpm
with:
cache: "false"
install: "false"

- name: Run npm release preflight
uses: ./.github/actions/check-release-state
with:
registry-url: https://registry.npmjs.org/

gui-release-preflight:
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v6

- name: Run GUI release preflight
uses: ./.github/actions/check-gui-release-state
with:
github-token: ${{ github.token }}

check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
Expand Down
66 changes: 7 additions & 59 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,52 +58,13 @@ jobs:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-node-pnpm
with:
cache: "false"
install: "false"

- name: Check if should publish
id: check
run: |
check_publish_state() {
local package_json_path="$1"
local output_key="$2"
local version
local name
local published_version

version=$(jq -r '.version' "$package_json_path")
name=$(jq -r '.name' "$package_json_path")
published_version=$(npm view "${name}@${version}" version --registry "$NPM_REGISTRY_URL" 2>/dev/null || echo "")

if [[ "$version" != "$published_version" ]]; then
echo "$name@$version is not published to npm, will publish"
echo "${output_key}=true" >> "$GITHUB_OUTPUT"
return 0
fi

echo "$name@$version already published to npm, skipping"
echo "${output_key}=false" >> "$GITHUB_OUTPUT"
return 1
}

version=$(jq -r '.version' package.json)
echo "version=$version" >> "$GITHUB_OUTPUT"

cli_needs_publish=false
mcp_needs_publish=false

if check_publish_state cli/package.json publish_cli; then
cli_needs_publish=true
fi

if check_publish_state mcp/package.json publish_mcp; then
mcp_needs_publish=true
fi

if [[ "$cli_needs_publish" == "true" || "$mcp_needs_publish" == "true" ]]; then
echo "publish_npm=true" >> "$GITHUB_OUTPUT"
else
echo "publish_npm=false" >> "$GITHUB_OUTPUT"
fi
uses: ./.github/actions/check-release-state
with:
registry-url: ${{ env.NPM_REGISTRY_URL }}

# 1.5. GUI 版本检查(独立于 npm,检查 GitHub Release)
check-gui-version:
Expand All @@ -114,24 +75,11 @@ jobs:
version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@v6

- name: Check if GUI should be released
id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(jq -r '.version' gui/package.json)
echo "GUI version: $version"

# Check if this version tag exists on GitHub
if gh release view "v${version}" >/dev/null 2>&1; then
echo "Release v${version} already exists on GitHub, skipping GUI"
echo "should_release=false" >> "$GITHUB_OUTPUT"
else
echo "Release v${version} does not exist, will build GUI"
echo "should_release=true" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
fi
uses: ./.github/actions/check-gui-release-state
with:
github-token: ${{ github.token }}

# 2. 构建 NAPI 二进制(5 平台矩阵)
build-napi:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ members = [
]

[workspace.package]
version = "2026.10402.103"
version = "2026.10402.109"
edition = "2024"
rust-version = "1.88"
license = "AGPL-3.0-only"
Expand Down
2 changes: 1 addition & 1 deletion cli/npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@truenine/memory-sync-cli-darwin-arm64",
"version": "2026.10402.103",
"version": "2026.10402.109",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion cli/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@truenine/memory-sync-cli-darwin-x64",
"version": "2026.10402.103",
"version": "2026.10402.109",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion cli/npm/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@truenine/memory-sync-cli-linux-arm64-gnu",
"version": "2026.10402.103",
"version": "2026.10402.109",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion cli/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@truenine/memory-sync-cli-linux-x64-gnu",
"version": "2026.10402.103",
"version": "2026.10402.109",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion cli/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@truenine/memory-sync-cli-win32-x64-msvc",
"version": "2026.10402.103",
"version": "2026.10402.109",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@truenine/memory-sync-cli",
"type": "module",
"version": "2026.10402.103",
"version": "2026.10402.109",
"description": "TrueNine Memory Synchronization CLI shell",
"author": "TrueNine",
"license": "AGPL-3.0-only",
Expand Down
Loading
Loading