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
5 changes: 4 additions & 1 deletion .coding-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ stages:
- "echo \"//r.tnpm.oa.com/:_auth=$(echo -n \"${NPM_USERNAME}:${NPM_TOKEN}\" | base64)\" > .npmrc"
- npm ci --ignore-scripts
- npm run build
- npm publish --registry http://r.tnpm.oa.com
# Resolve the dist-tag from the version: a prerelease (e.g. 0.21.0-beta.0)
# publishes to its own channel (beta/rc/...), never to `latest` — the tag
# the CLI's auto-update check reads for @tencent/teamai-cli (src/update.ts).
- "PKG_VERSION=$(node -p \"require('./package.json').version\")\ncase \"$PKG_VERSION\" in\n *-*)\n PRE=\"${PKG_VERSION#*-}\"\n DIST_TAG=\"${PRE%%.*}\"\n case \"$DIST_TAG\" in\n ''|*[!a-zA-Z]*) DIST_TAG=\"beta\" ;;\n esac\n ;;\n *)\n DIST_TAG=\"latest\"\n ;;\nesac\necho \"Publishing $PKG_VERSION with dist-tag: $DIST_TAG\"\nnpm publish --registry http://r.tnpm.oa.com --tag \"$DIST_TAG\"\n"
- rm -f .npmrc
trigger:
branches:
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,41 @@ jobs:
- name: Build
run: npm run build

- name: Resolve dist-tag
id: disttag
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
case "$PKG_VERSION" in
*-*)
# Prerelease (e.g. 0.21.0-beta.0). Derive the dist-tag from the
# first prerelease identifier (beta, rc, alpha, ...) so it lands
# on its own channel and NEVER on `latest` — the tag consumed by
# the CLI's auto-update check (src/update.ts).
PRE="${PKG_VERSION#*-}"
DIST_TAG="${PRE%%.*}"
# npm rejects dist-tags that look like a semver version, so fall
# back to `beta` when the identifier isn't a plain word.
case "$DIST_TAG" in
''|*[!a-zA-Z]*) DIST_TAG="beta" ;;
esac
IS_PRERELEASE=true
;;
*)
DIST_TAG="latest"
IS_PRERELEASE=false
;;
esac
echo "Publishing $PKG_VERSION with dist-tag: $DIST_TAG (prerelease=$IS_PRERELEASE)"
echo "dist_tag=$DIST_TAG" >> "$GITHUB_OUTPUT"
echo "is_prerelease=$IS_PRERELEASE" >> "$GITHUB_OUTPUT"

- name: Publish
run: npm publish --provenance --access public
run: npm publish --provenance --access public --tag "${{ steps.disttag.outputs.dist_tag }}"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
prerelease: ${{ steps.disttag.outputs.is_prerelease == 'true' }}
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ git push origin main --tags

CI stages: validate (lint + test) -> build -> e2e -> publish (tag builds only).

Prerelease versions (`npm version prerelease --preid=beta` → `0.21.0-beta.0`) publish to a matching dist-tag (`beta`, `rc`, ...) instead of `latest`, so auto-update is unaffected.

## Git Conventions

- **Default branch**: `main` (not `master`). All worktrees and PRs should be based on `origin/main`.
Expand Down
Loading