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
22 changes: 13 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- mac

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
RTK_INSTALL_GITHUB_TOKEN: ${{ secrets.RTK_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
RTK_INSTALL_GITHUB_TOKEN_SOURCE: ${{ secrets.RTK_GITHUB_TOKEN != '' && 'RTK_GITHUB_TOKEN' || 'GITHUB_TOKEN' }}

Expand All @@ -29,12 +30,13 @@ jobs:
- arch: x64
platform: win-x64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '22.13.1'
package-manager-cache: false

- name: Setup pnpm
uses: pnpm/action-setup@v2
Expand Down Expand Up @@ -78,7 +80,7 @@ jobs:
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: deepchat-${{ matrix.platform }}
path: |
Expand All @@ -96,12 +98,13 @@ jobs:
- arch: x64
platform: linux-x64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '22.13.1'
package-manager-cache: false

- name: Setup pnpm
uses: pnpm/action-setup@v2
Expand Down Expand Up @@ -134,7 +137,7 @@ jobs:
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: deepchat-${{ matrix.platform }}
path: |
Expand All @@ -153,12 +156,13 @@ jobs:
- arch: arm64
platform: mac-arm64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '22.13.1'
package-manager-cache: false

- name: Setup pnpm
uses: pnpm/action-setup@v2
Expand Down Expand Up @@ -205,7 +209,7 @@ jobs:
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: deepchat-${{ matrix.platform }}
path: |
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/prcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- main
- dev

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
Comment on lines +9 to +10
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Upgrade pnpm/action-setup before forcing Node 24

Setting FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 here makes every JavaScript action in this workflow run under Node 24, but this workflow still invokes pnpm/action-setup@v2 a few lines below. The pnpm action’s marketplace page now warns that v2 “has stopped working” with newer Node.js versions, so PR checks/builds/releases can start failing before pnpm install even runs. Please either keep these workflows on the current action runtime or bump pnpm/action-setup to a Node-24-compatible major first.

Useful? React with 👍 / 👎.


jobs:
main-release-guard:
if: github.base_ref == 'main'
Expand All @@ -20,7 +23,7 @@ jobs:
exit 1
fi

- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
Expand All @@ -43,12 +46,13 @@ jobs:
include:
- arch: x64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '22.13.1'
package-manager-cache: false

- name: Setup pnpm
uses: pnpm/action-setup@v2
Expand Down
30 changes: 17 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ permissions:
contents: write

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
RTK_INSTALL_GITHUB_TOKEN: ${{ secrets.RTK_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
RTK_INSTALL_GITHUB_TOKEN_SOURCE: ${{ secrets.RTK_GITHUB_TOKEN != '' && 'RTK_GITHUB_TOKEN' || 'GITHUB_TOKEN' }}

Expand All @@ -27,7 +28,7 @@ jobs:
steps:
- name: Resolve tag
id: resolve
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
script: |
const isDispatch = context.eventName === 'workflow_dispatch'
Expand Down Expand Up @@ -96,7 +97,7 @@ jobs:
needs: resolve-tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ needs.resolve-tag.outputs.sha }}
fetch-depth: 0
Expand All @@ -121,15 +122,16 @@ jobs:
- arch: x64
platform: win-x64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ needs.resolve-tag.outputs.sha }}
fetch-depth: 1

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '22.13.1'
package-manager-cache: false

- name: Setup pnpm
uses: pnpm/action-setup@v2
Expand Down Expand Up @@ -174,7 +176,7 @@ jobs:
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: deepchat-${{ matrix.platform }}
path: |
Expand All @@ -192,15 +194,16 @@ jobs:
- arch: x64
platform: linux-x64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ needs.resolve-tag.outputs.sha }}
fetch-depth: 1

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '22.13.1'
package-manager-cache: false

- name: Setup pnpm
uses: pnpm/action-setup@v2
Expand Down Expand Up @@ -231,7 +234,7 @@ jobs:
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: deepchat-${{ matrix.platform }}
path: |
Expand All @@ -250,15 +253,16 @@ jobs:
- arch: arm64
platform: mac-arm64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ needs.resolve-tag.outputs.sha }}
fetch-depth: 1

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '22.13.1'
package-manager-cache: false

- name: Setup pnpm
uses: pnpm/action-setup@v2
Expand Down Expand Up @@ -306,7 +310,7 @@ jobs:
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: deepchat-${{ matrix.platform }}
path: |
Expand All @@ -322,7 +326,7 @@ jobs:
- build-mac
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ needs.resolve-tag.outputs.sha }}
fetch-depth: 1
Expand Down Expand Up @@ -369,7 +373,7 @@ jobs:
fi

- name: Download build artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
path: artifacts

Expand Down
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ We use GitHub to host code, to track issues and feature requests, as well as acc
- Keep `dev` as the integration branch and `main` as the stable mirror.
- Cut a short-lived `release/<version>` branch from an existing commit on `dev`.
- Open `release/<version> -> main` for review and CI, but do not use the GitHub merge button to land it.
- After review, fast-forward `main` locally and then create the release tag on the same commit.
- See [docs/release-flow.md](./docs/release-flow.md) for the full maintainer procedure and guardrails.
- macOS and Linux maintainers can land the approved release with `pnpm run release:ff -- release/<version> --tag v<version>`.
- Windows maintainers must use the documented manual release steps instead of `pnpm run release:ff`.
- Create the release tag on the same commit after `main` has been fast-forwarded.
- See [docs/release-flow.md](./docs/release-flow.md) for the full maintainer procedure, manual fallback, and guardrails.

### External Contributors

Expand Down
11 changes: 11 additions & 0 deletions CONTRIBUTING.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
- 创建新的功能分支,命名格式为 `feature/featurename`
- 开发完成后将功能分支合并到 `dev` 分支

#### 维护者发布流程

- 保持 `dev` 为集成分支,`main` 为稳定镜像分支。
- 从 `dev` 上已有的待发布提交切出短生命周期 `release/<version>` 分支。
- 提交 `release/<version> -> main` PR 仅用于评审和 CI,请不要用 GitHub merge 按钮合并。
- macOS 和 Linux 维护者可使用 `pnpm run release:ff -- release/<version> --tag v<version>` 落地发布。
- Windows 维护者不要使用 `pnpm run release:ff`,请改走手动发布流程。
- `main` fast-forward 完成后,再在同一提交上创建 release tag。
- 完整流程、手动兜底方式与约束请见 [docs/release-flow.md](./docs/release-flow.md)。

### 外部贡献者

1. Fork 本仓库到您的个人账号
Expand Down Expand Up @@ -170,6 +180,7 @@ pnpm run dev
3. 本地确认 format + lint + typecheck + 相关测试,如未执行请在 PR 备注。
4. 目标分支为 `dev`;外部贡献者请先 Fork,再向 `dev` 提 PR。
5. 至少需一位维护者批准后合并。
6. 指向 `main` 的 PR 仅保留给 `release/<version>` 分支做评审与 CI,实际发布请按 [docs/release-flow.md](./docs/release-flow.md) 中的 `ff-only` 流程执行。

## 有问题?

Expand Down
67 changes: 65 additions & 2 deletions docs/release-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This document defines the maintainer release flow for DeepChat without rewriting

- Keep `dev` as the only long-lived integration branch.
- Keep `main` as a stable mirror of reviewed release commits.
- Keep releases tag-driven through [`.github/workflows/release.yml`](/Users/zerob13/Documents/deepchat/.github/workflows/release.yml).
- Keep releases tag-driven through [`.github/workflows/release.yml`](../.github/workflows/release.yml).
- Avoid creating new merge commits on `main`.

## Branch Roles
Expand Down Expand Up @@ -52,7 +52,7 @@ This document defines the maintainer release flow for DeepChat without rewriting

Use `--force-with-lease` only because the release branch is a disposable review branch that must stay identical to a commit already on `dev`.

5. After the PR is approved, fast-forward `main` locally.
5. After the PR is approved, fast-forward `main` locally on macOS or Linux.

```bash
pnpm run release:ff -- release/v1.0.0-beta.4 --tag v1.0.0-beta.4
Expand All @@ -65,6 +65,8 @@ This document defines the maintainer release flow for DeepChat without rewriting
- `origin/main` is an ancestor of the target commit
- `main` can be updated with `git merge --ff-only`

Windows maintainers should skip this helper and use the manual release sequence below.

6. Create and push the release tag on the same commit.

```bash
Expand All @@ -79,6 +81,67 @@ This document defines the maintainer release flow for DeepChat without rewriting
git branch -d release/v1.0.0-beta.4
```

## Manual Release Sequence

Use this sequence when the automatic helper is unavailable, especially on Windows. It updates `origin/main` directly from the reviewed release commit and does not depend on the state of your local `main`.

1. Fetch the latest release refs.

```bash
git fetch origin main dev --prune
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fetch the release ref before resolving origin/release/*

I checked git fetch -h (git fetch [<options>] [<repository> [<refspec>...]]), so git fetch origin main dev --prune only updates the main and dev refspecs. The very next step resolves origin/release/v…^{commit}, which will be missing in a fresh clone unless that release branch was already fetched locally, so the new Windows/manual fallback can fail at step 2 before any ancestry checks run. Either fetch the release/* ref here or rewrite step 2 around a ref that step 1 guarantees is present.

Useful? React with 👍 / 👎.

```

2. Resolve the reviewed release commit and record it as `TARGET_SHA`.

```bash
git rev-parse origin/release/v1.0.0-beta.4^{commit}
# or
git rev-parse release/v1.0.0-beta.4^{commit}
# or
git rev-parse <target-ref>^{commit}
```

3. Confirm the release commit already exists on `origin/dev`.

```bash
git merge-base --is-ancestor <TARGET_SHA> origin/dev
```

4. Confirm `origin/main` can be fast-forwarded to the reviewed release commit.

```bash
git merge-base --is-ancestor origin/main <TARGET_SHA>
```

5. Confirm the release tag does not already exist locally or on `origin`.

```bash
git rev-parse --verify --quiet refs/tags/v1.0.0-beta.4
git ls-remote --exit-code --tags origin refs/tags/v1.0.0-beta.4
```

Both commands should report that the tag is missing before you continue.

6. Fast-forward `origin/main` directly to the reviewed release commit.

```bash
git push origin <TARGET_SHA>:refs/heads/main
```

7. Create and push the release tag on the same commit.

```bash
git tag v1.0.0-beta.4 <TARGET_SHA>
git push origin refs/tags/v1.0.0-beta.4
```

8. Delete the temporary release branch after the release is published.

```bash
git push origin --delete release/v1.0.0-beta.4
git branch -d release/v1.0.0-beta.4
```

## Repository Settings

These settings are not stored in the repository and must be configured manually on GitHub:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dev:inspect": "electron-vite dev --watch --inspect=9229",
"dev:linux": "electron-vite dev --watch --noSandbox",
"build": "pnpm run typecheck && electron-vite build",
"release:ff": "bash scripts/release-fast-forward.sh",
"release:ff": "node scripts/release-fast-forward.mjs",
"postinstall": "electron-builder install-app-deps && simple-git-hooks",
"build:unpack": "pnpm run build && electron-builder --dir",
"build:win": "pnpm run build && electron-builder --win",
Expand Down
Loading
Loading