Skip to content

Commit fad615e

Browse files
authored
chore(release): add win fallback and node24 (#1363)
1 parent 7f19f6e commit fad615e

9 files changed

Lines changed: 154 additions & 30 deletions

File tree

.github/workflows/build.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
- mac
1616

1717
env:
18+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
1819
RTK_INSTALL_GITHUB_TOKEN: ${{ secrets.RTK_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1920
RTK_INSTALL_GITHUB_TOKEN_SOURCE: ${{ secrets.RTK_GITHUB_TOKEN != '' && 'RTK_GITHUB_TOKEN' || 'GITHUB_TOKEN' }}
2021

@@ -29,12 +30,13 @@ jobs:
2930
- arch: x64
3031
platform: win-x64
3132
steps:
32-
- uses: actions/checkout@v4
33+
- uses: actions/checkout@v6
3334

3435
- name: Setup Node.js
35-
uses: actions/setup-node@v4
36+
uses: actions/setup-node@v6
3637
with:
3738
node-version: '22.13.1'
39+
package-manager-cache: false
3840

3941
- name: Setup pnpm
4042
uses: pnpm/action-setup@v2
@@ -78,7 +80,7 @@ jobs:
7880
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}
7981

8082
- name: Upload artifacts
81-
uses: actions/upload-artifact@v4
83+
uses: actions/upload-artifact@v6
8284
with:
8385
name: deepchat-${{ matrix.platform }}
8486
path: |
@@ -96,12 +98,13 @@ jobs:
9698
- arch: x64
9799
platform: linux-x64
98100
steps:
99-
- uses: actions/checkout@v4
101+
- uses: actions/checkout@v6
100102

101103
- name: Setup Node.js
102-
uses: actions/setup-node@v4
104+
uses: actions/setup-node@v6
103105
with:
104106
node-version: '22.13.1'
107+
package-manager-cache: false
105108

106109
- name: Setup pnpm
107110
uses: pnpm/action-setup@v2
@@ -134,7 +137,7 @@ jobs:
134137
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}
135138

136139
- name: Upload artifacts
137-
uses: actions/upload-artifact@v4
140+
uses: actions/upload-artifact@v6
138141
with:
139142
name: deepchat-${{ matrix.platform }}
140143
path: |
@@ -153,12 +156,13 @@ jobs:
153156
- arch: arm64
154157
platform: mac-arm64
155158
steps:
156-
- uses: actions/checkout@v4
159+
- uses: actions/checkout@v6
157160

158161
- name: Setup Node.js
159-
uses: actions/setup-node@v4
162+
uses: actions/setup-node@v6
160163
with:
161164
node-version: '22.13.1'
165+
package-manager-cache: false
162166

163167
- name: Setup pnpm
164168
uses: pnpm/action-setup@v2
@@ -205,7 +209,7 @@ jobs:
205209
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}
206210

207211
- name: Upload artifacts
208-
uses: actions/upload-artifact@v4
212+
uses: actions/upload-artifact@v6
209213
with:
210214
name: deepchat-${{ matrix.platform }}
211215
path: |

.github/workflows/prcheck.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- main
77
- dev
88

9+
env:
10+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
11+
912
jobs:
1013
main-release-guard:
1114
if: github.base_ref == 'main'
@@ -20,7 +23,7 @@ jobs:
2023
exit 1
2124
fi
2225
23-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v6
2427
with:
2528
ref: ${{ github.event.pull_request.head.sha }}
2629
fetch-depth: 0
@@ -43,12 +46,13 @@ jobs:
4346
include:
4447
- arch: x64
4548
steps:
46-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v6
4750

4851
- name: Setup Node.js
49-
uses: actions/setup-node@v4
52+
uses: actions/setup-node@v6
5053
with:
5154
node-version: '22.13.1'
55+
package-manager-cache: false
5256

5357
- name: Setup pnpm
5458
uses: pnpm/action-setup@v2

.github/workflows/release.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ permissions:
1515
contents: write
1616

1717
env:
18+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
1819
RTK_INSTALL_GITHUB_TOKEN: ${{ secrets.RTK_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1920
RTK_INSTALL_GITHUB_TOKEN_SOURCE: ${{ secrets.RTK_GITHUB_TOKEN != '' && 'RTK_GITHUB_TOKEN' || 'GITHUB_TOKEN' }}
2021

@@ -27,7 +28,7 @@ jobs:
2728
steps:
2829
- name: Resolve tag
2930
id: resolve
30-
uses: actions/github-script@v7
31+
uses: actions/github-script@v8
3132
with:
3233
script: |
3334
const isDispatch = context.eventName === 'workflow_dispatch'
@@ -96,7 +97,7 @@ jobs:
9697
needs: resolve-tag
9798
runs-on: ubuntu-latest
9899
steps:
99-
- uses: actions/checkout@v4
100+
- uses: actions/checkout@v6
100101
with:
101102
ref: ${{ needs.resolve-tag.outputs.sha }}
102103
fetch-depth: 0
@@ -121,15 +122,16 @@ jobs:
121122
- arch: x64
122123
platform: win-x64
123124
steps:
124-
- uses: actions/checkout@v4
125+
- uses: actions/checkout@v6
125126
with:
126127
ref: ${{ needs.resolve-tag.outputs.sha }}
127128
fetch-depth: 1
128129

129130
- name: Setup Node.js
130-
uses: actions/setup-node@v4
131+
uses: actions/setup-node@v6
131132
with:
132133
node-version: '22.13.1'
134+
package-manager-cache: false
133135

134136
- name: Setup pnpm
135137
uses: pnpm/action-setup@v2
@@ -174,7 +176,7 @@ jobs:
174176
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}
175177

176178
- name: Upload artifacts
177-
uses: actions/upload-artifact@v4
179+
uses: actions/upload-artifact@v6
178180
with:
179181
name: deepchat-${{ matrix.platform }}
180182
path: |
@@ -192,15 +194,16 @@ jobs:
192194
- arch: x64
193195
platform: linux-x64
194196
steps:
195-
- uses: actions/checkout@v4
197+
- uses: actions/checkout@v6
196198
with:
197199
ref: ${{ needs.resolve-tag.outputs.sha }}
198200
fetch-depth: 1
199201

200202
- name: Setup Node.js
201-
uses: actions/setup-node@v4
203+
uses: actions/setup-node@v6
202204
with:
203205
node-version: '22.13.1'
206+
package-manager-cache: false
204207

205208
- name: Setup pnpm
206209
uses: pnpm/action-setup@v2
@@ -231,7 +234,7 @@ jobs:
231234
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}
232235

233236
- name: Upload artifacts
234-
uses: actions/upload-artifact@v4
237+
uses: actions/upload-artifact@v6
235238
with:
236239
name: deepchat-${{ matrix.platform }}
237240
path: |
@@ -250,15 +253,16 @@ jobs:
250253
- arch: arm64
251254
platform: mac-arm64
252255
steps:
253-
- uses: actions/checkout@v4
256+
- uses: actions/checkout@v6
254257
with:
255258
ref: ${{ needs.resolve-tag.outputs.sha }}
256259
fetch-depth: 1
257260

258261
- name: Setup Node.js
259-
uses: actions/setup-node@v4
262+
uses: actions/setup-node@v6
260263
with:
261264
node-version: '22.13.1'
265+
package-manager-cache: false
262266

263267
- name: Setup pnpm
264268
uses: pnpm/action-setup@v2
@@ -306,7 +310,7 @@ jobs:
306310
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}
307311

308312
- name: Upload artifacts
309-
uses: actions/upload-artifact@v4
313+
uses: actions/upload-artifact@v6
310314
with:
311315
name: deepchat-${{ matrix.platform }}
312316
path: |
@@ -322,7 +326,7 @@ jobs:
322326
- build-mac
323327
runs-on: ubuntu-latest
324328
steps:
325-
- uses: actions/checkout@v4
329+
- uses: actions/checkout@v6
326330
with:
327331
ref: ${{ needs.resolve-tag.outputs.sha }}
328332
fetch-depth: 1
@@ -369,7 +373,7 @@ jobs:
369373
fi
370374
371375
- name: Download build artifacts
372-
uses: actions/download-artifact@v4
376+
uses: actions/download-artifact@v8
373377
with:
374378
path: artifacts
375379

CONTRIBUTING.md

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

3840
### External Contributors
3941

CONTRIBUTING.zh.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
- 创建新的功能分支,命名格式为 `feature/featurename`
2828
- 开发完成后将功能分支合并到 `dev` 分支
2929

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

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

docs/release-flow.md

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document defines the maintainer release flow for DeepChat without rewriting
66

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

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

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

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

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

68+
Windows maintainers should skip this helper and use the manual release sequence below.
69+
6870
6. Create and push the release tag on the same commit.
6971

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

84+
## Manual Release Sequence
85+
86+
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`.
87+
88+
1. Fetch the latest release refs.
89+
90+
```bash
91+
git fetch origin main dev --prune
92+
```
93+
94+
2. Resolve the reviewed release commit and record it as `TARGET_SHA`.
95+
96+
```bash
97+
git rev-parse origin/release/v1.0.0-beta.4^{commit}
98+
# or
99+
git rev-parse release/v1.0.0-beta.4^{commit}
100+
# or
101+
git rev-parse <target-ref>^{commit}
102+
```
103+
104+
3. Confirm the release commit already exists on `origin/dev`.
105+
106+
```bash
107+
git merge-base --is-ancestor <TARGET_SHA> origin/dev
108+
```
109+
110+
4. Confirm `origin/main` can be fast-forwarded to the reviewed release commit.
111+
112+
```bash
113+
git merge-base --is-ancestor origin/main <TARGET_SHA>
114+
```
115+
116+
5. Confirm the release tag does not already exist locally or on `origin`.
117+
118+
```bash
119+
git rev-parse --verify --quiet refs/tags/v1.0.0-beta.4
120+
git ls-remote --exit-code --tags origin refs/tags/v1.0.0-beta.4
121+
```
122+
123+
Both commands should report that the tag is missing before you continue.
124+
125+
6. Fast-forward `origin/main` directly to the reviewed release commit.
126+
127+
```bash
128+
git push origin <TARGET_SHA>:refs/heads/main
129+
```
130+
131+
7. Create and push the release tag on the same commit.
132+
133+
```bash
134+
git tag v1.0.0-beta.4 <TARGET_SHA>
135+
git push origin refs/tags/v1.0.0-beta.4
136+
```
137+
138+
8. Delete the temporary release branch after the release is published.
139+
140+
```bash
141+
git push origin --delete release/v1.0.0-beta.4
142+
git branch -d release/v1.0.0-beta.4
143+
```
144+
82145
## Repository Settings
83146

84147
These settings are not stored in the repository and must be configured manually on GitHub:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"dev:inspect": "electron-vite dev --watch --inspect=9229",
3232
"dev:linux": "electron-vite dev --watch --noSandbox",
3333
"build": "pnpm run typecheck && electron-vite build",
34-
"release:ff": "bash scripts/release-fast-forward.sh",
34+
"release:ff": "node scripts/release-fast-forward.mjs",
3535
"postinstall": "electron-builder install-app-deps && simple-git-hooks",
3636
"build:unpack": "pnpm run build && electron-builder --dir",
3737
"build:win": "pnpm run build && electron-builder --win",

0 commit comments

Comments
 (0)