更新core流程

This commit is contained in:
YHH
2025-10-18 20:45:45 +08:00
parent bf25218af2
commit 5f6b2d4d40

View File

@@ -126,54 +126,57 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '20.x' node-version: '20.x'
cache: 'npm'
- name: Get new version - name: Configure Git
id: version run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Install dependencies
run: npm ci
- name: Update version in package.json
run: | run: |
cd packages/core cd packages/core
CURRENT_VERSION=$(node -p "require('./package.json').version")
if [ -n "${{ github.event.inputs.custom_version }}" ]; then if [ -n "${{ github.event.inputs.custom_version }}" ]; then
NEW_VERSION="${{ github.event.inputs.custom_version }}" NEW_VERSION="${{ github.event.inputs.custom_version }}"
else else
npm version ${{ github.event.inputs.version_type }} --no-git-tag-version npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
NEW_VERSION=$(node -p "require('./package.json').version") NEW_VERSION=$(node -p "require('./package.json').version")
git checkout package.json
fi fi
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Update version in package.json
run: |
cd packages/core
npm version ${{ steps.version.outputs.new_version }} --no-git-tag-version
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore(core): bump version to ${{ steps.version.outputs.new_version }}" commit-message: "chore(core): bump version to ${{ env.NEW_VERSION }}"
branch: release/core-v${{ steps.version.outputs.new_version }} branch: release/core-v${{ env.NEW_VERSION }}
delete-branch: true delete-branch: true
title: "chore(core): Release v${{ steps.version.outputs.new_version }}" title: "chore(core): Release v${{ env.NEW_VERSION }}"
body: | body: |
## 🚀 Release @esengine/ecs-framework v${{ steps.version.outputs.new_version }} ## 🚀 Release @esengine/ecs-framework v${{ env.NEW_VERSION }}
This PR updates the core package version after successful npm release. This PR updates the core package version after successful npm release.
### Changes ### Changes
- ✅ Updated `packages/core/package.json` → `${{ steps.version.outputs.new_version }}` - ✅ Updated `packages/core/package.json` → `${{ env.NEW_VERSION }}`
### Release Information ### Release Information
- 📦 **Version Type**: `${{ github.event.inputs.version_type }}` - 📦 **Version Type**: `${{ github.event.inputs.version_type }}`
- 🏷️ **Git Tag**: `core-v${{ steps.version.outputs.new_version }}` - 🏷️ **Git Tag**: `core-v${{ env.NEW_VERSION }}`
- 📋 [GitHub Release](https://github.com/${{ github.repository }}/releases/tag/core-v${{ steps.version.outputs.new_version }}) - 📋 [GitHub Release](https://github.com/${{ github.repository }}/releases/tag/core-v${{ env.NEW_VERSION }})
- 📦 [npm Package](https://www.npmjs.com/package/@esengine/ecs-framework/v/${{ steps.version.outputs.new_version }}) - 📦 [npm Package](https://www.npmjs.com/package/@esengine/ecs-framework/v/${{ env.NEW_VERSION }})
### Next Steps ### Next Steps
- [ ] Review the changes - [ ] Review the changes