A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Publish to npm from a GitHub release through Trusted Publishing
Fei241139b651c8dc72
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlnew file mode 100644index 00000000..cc523b5c--- /dev/null+++ b/.github/workflows/release.yml@@ -0,0 +1,82 @@+name: Release++# Publishes ds-bot to npm when a GitHub release is published.+#+# npm Trusted Publishing: npm trusts this workflow through GitHub's OIDC token, so the+# repository keeps no npm token, and every version gets a provenance statement. It is set+# up once on npmjs.com: package ds-bot → Settings → Trusted Publisher → GitHub Actions,+# user Fei2411, repository DeepSeek-Bot, workflow release.yml, no environment.+#+# The release tag must be v<version in ds-bot/package.json> and must point at a commit on+# main. A version with a pre-release part (0.2.0-rc.1) goes to the npm tag "next", so that+# "latest" stays on the last stable version.++on:+ release:+ types: [published]+ workflow_dispatch:+ inputs:+ dry_run:+ description: Run every check and pack the package, but do not publish+ type: boolean+ default: true++permissions:+ contents: read+ id-token: write++concurrency:+ group: release+ cancel-in-progress: false++jobs:+ publish:+ name: Check and publish+ runs-on: ubuntu-latest+ timeout-minutes: 20+ defaults:+ run:+ shell: bash+ working-directory: ds-bot+ steps:+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0+ - uses: actions/setup-node@v4+ with:+ node-version: 24+ registry-url: https://registry.npmjs.org+ # Trusted Publishing needs npm 11.5.1 or later.+ - run: npm install -g [email protected] --no-fund --no-audit++ - name: Check the tag and the branch+ if: github.event_name == 'release'+ env:+ TAG: ${{ github.event.release.tag_name }}+ run: |+ version="$(node -p "require('./package.json').version")"+ if [ "$TAG" != "v$version" ]; then+ echo "::error::The release tag is $TAG, but ds-bot/package.json has version $version. Tag v$version or change the version."+ exit 1+ fi+ if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then+ echo "::error::$TAG points at a commit that is not on main. Release from main."+ exit 1+ fi++ - run: npm ci --no-fund --no-audit+ - run: npm run harness+ - run: npm test+ - run: node scripts/build-client.mjs --check+ - run: npm run lint++ - name: Pack (dry run)+ if: github.event_name == 'workflow_dispatch' && inputs.dry_run+ run: npm publish --dry-run --access public++ - name: Publish+ if: github.event_name == 'release' || (!inputs.dry_run && github.ref == 'refs/heads/main')+ run: |+ tag="$(node -p "require('./package.json').version.includes('-') ? 'next' : 'latest'")"+ echo "Publishing $(node -p "require('./package.json').version") with the npm tag $tag"+ npm publish --provenance --access public --tag "$tag"diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex b49e5cba..f67080d3 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -72,7 +72,7 @@ Keep one pull request to one issue. Split a large change into several pull reque1. In a pull request into `dev`, set the version in `ds-bot/package.json` and write the `CHANGELOG.md` section from the Changelog sentences of the merged pull requests.2. Open a pull request from `dev` into `main` titled `release: vX.Y.Z`. List every `Fixes #<number>` of the release in its description, so that these issues close when it is merged.-3. Merge it with a merge commit and publish a GitHub release `vX.Y.Z` on `main`.+3. Merge it with a merge commit and publish a GitHub release `vX.Y.Z` on `main`. The Release workflow checks that the tag matches the version and is on `main`, runs the checks and publishes the package to npm (a pre-release version under the npm tag `next`). Do not run `npm publish` by hand.4. For a hotfix, start `fix/hot-<name>` from `main`, open the pull request into `main`, release a patch version, then merge `main` into `dev`.## Set updiff --git a/CONTRIBUTING.zh.md b/CONTRIBUTING.zh.mdindex d8e32094..d0ca351d 100644--- a/CONTRIBUTING.zh.md+++ b/CONTRIBUTING.zh.md@@ -72,7 +72,7 @@1. 向 `dev` 提一个 Pull Request:修改 `ds-bot/package.json` 里的版本号,根据已合并 Pull Request 的 Changelog 句子写 `CHANGELOG.md` 的这一版。2. 提一个从 `dev` 到 `main` 的 Pull Request,标题为 `release: vX.Y.Z`。在描述里列出这一版所有的 `Fixes #<号>`,合并时这些 Issue 会一起关闭。-3. 用 merge commit 合并,在 `main` 上发布 GitHub Release `vX.Y.Z`。+3. 用 merge commit 合并,在 `main` 上发布 GitHub Release `vX.Y.Z`。Release 工作流会检查 tag 与版本号一致、且在 `main` 上,跑完检查后把包发到 npm(预发布版本发到 npm 的 `next` 标签)。不要手动 `npm publish`。4. 热修:从 `main` 切 `fix/hot-<短名>`,向 `main` 提 Pull Request,发一个补丁版本,再把 `main` 合回 `dev`。## 搭建环境