* perf(core): 优化 EntitySystem 迭代性能,添加 CommandBuffer 延迟命令 ReactiveQuery 快照优化: - 添加快照机制,避免每帧拷贝数组 - 只在实体列表变化时创建新快照 - 静态场景下多个系统共享同一快照 CommandBuffer 延迟命令系统: - 支持延迟添加/移除组件、销毁实体、设置实体激活状态 - 每个系统拥有独立的 commands 属性 - 命令在帧末统一执行,避免迭代过程中修改实体列表 Scene 更新: - 在 lateUpdate 后自动刷新所有系统的命令缓冲区 文档: - 更新系统文档,添加 CommandBuffer 使用说明 * fix(ci): upgrade first-interaction action to v1.3.0 Fix Docker build failure in welcome workflow. * fix(ci): upgrade pnpm/action-setup to v4 and fix unused import - Upgrade pnpm/action-setup@v2 to v4 in all workflow files - Remove unused CommandType import in CommandBuffer.test.ts * fix(ci): remove duplicate pnpm version specification
134 lines
4.5 KiB
YAML
134 lines
4.5 KiB
YAML
name: Release NPM Packages
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
package:
|
|
description: '选择要发布的包'
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- core
|
|
- behavior-tree
|
|
- editor-core
|
|
- node-editor
|
|
- blueprint
|
|
- tilemap
|
|
- physics-rapier2d
|
|
version_type:
|
|
description: '版本更新类型'
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- patch
|
|
- minor
|
|
- major
|
|
- custom
|
|
custom_version:
|
|
description: '自定义版本号 (仅当选择 custom 时使用,例如: 2.2.9)'
|
|
required: false
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
id-token: write
|
|
|
|
jobs:
|
|
release-package:
|
|
name: Release ${{ github.event.inputs.package }} Package
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20.x'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Build core package (if needed)
|
|
if: ${{ github.event.inputs.package != 'core' && github.event.inputs.package != 'node-editor' }}
|
|
run: |
|
|
cd packages/core
|
|
pnpm run build
|
|
|
|
- name: Build node-editor package (if needed for blueprint)
|
|
if: ${{ github.event.inputs.package == 'blueprint' }}
|
|
run: |
|
|
cd packages/node-editor
|
|
pnpm run build
|
|
|
|
# - name: Run tests
|
|
# run: |
|
|
# cd packages/${{ github.event.inputs.package }}
|
|
# npm run test:ci
|
|
|
|
- name: Update version
|
|
id: version
|
|
run: |
|
|
cd packages/${{ github.event.inputs.package }}
|
|
if [ "${{ github.event.inputs.version_type }}" = "custom" ]; then
|
|
NEW_VERSION=${{ github.event.inputs.custom_version }}
|
|
else
|
|
# Get current version and bump it
|
|
CURRENT=$(node -p "require('./package.json').version")
|
|
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
|
|
case "${{ github.event.inputs.version_type }}" in
|
|
major) NEW_VERSION="$((MAJOR+1)).0.0" ;;
|
|
minor) NEW_VERSION="$MAJOR.$((MINOR+1)).0" ;;
|
|
patch) NEW_VERSION="$MAJOR.$MINOR.$((PATCH+1))" ;;
|
|
esac
|
|
fi
|
|
# Update package.json using node
|
|
node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json')); pkg.version='$NEW_VERSION'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2)+'\n')"
|
|
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
echo "发布版本: $NEW_VERSION"
|
|
|
|
- name: Build package
|
|
run: |
|
|
cd packages/${{ github.event.inputs.package }}
|
|
pnpm run build:npm
|
|
|
|
- name: Publish to npm
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
run: |
|
|
cd packages/${{ github.event.inputs.package }}/dist
|
|
pnpm publish --access public --no-git-checks
|
|
|
|
- name: Create Pull Request
|
|
uses: peter-evans/create-pull-request@v6
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
commit-message: "chore(${{ github.event.inputs.package }}): release v${{ steps.version.outputs.new_version }}"
|
|
branch: release/${{ github.event.inputs.package }}-v${{ steps.version.outputs.new_version }}
|
|
delete-branch: true
|
|
title: "chore(${{ github.event.inputs.package }}): Release v${{ steps.version.outputs.new_version }}"
|
|
body: |
|
|
## 🚀 Release v${{ steps.version.outputs.new_version }}
|
|
|
|
此 PR 更新 `@esengine/${{ github.event.inputs.package }}` 包的版本号
|
|
|
|
### 变更
|
|
- ✅ 已发布到 npm: [@esengine/${{ github.event.inputs.package }}@${{ steps.version.outputs.new_version }}](https://www.npmjs.com/package/@esengine/${{ github.event.inputs.package }}/v/${{ steps.version.outputs.new_version }})
|
|
- ✅ 更新 `packages/${{ github.event.inputs.package }}/package.json` → `${{ steps.version.outputs.new_version }}`
|
|
|
|
---
|
|
*此 PR 由发布工作流自动创建*
|
|
labels: |
|
|
release
|
|
${{ github.event.inputs.package }}
|
|
automated pr
|