chore: 统一版本管理并添加自动发布工作流
- 将子项目版本号重置为 0.0.0,移除 private 标志 - 在根目录添加主 package.json 用于统一版本控制 - 更新 cwd-api 的包引用路径以使用根目录 package.json - 添加 GitHub Actions 工作流,当根版本号变更时自动创建发布
This commit is contained in:
55
.github/workflows/create_release.yml
vendored
Normal file
55
.github/workflows/create_release.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
name: Check and Create Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Get package.json version
|
||||
id: get_version
|
||||
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
|
||||
|
||||
- name: Get latest release version
|
||||
id: get_release
|
||||
run: |
|
||||
curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name' > latest_release.txt
|
||||
|
||||
- name: Compare versions
|
||||
id: compare_versions
|
||||
run: |
|
||||
LATEST_TAG="$(cat latest_release.txt 2>/dev/null || echo "")"
|
||||
if [ "$LATEST_TAG" = "null" ]; then
|
||||
LATEST_TAG=""
|
||||
fi
|
||||
NORMALIZED_LATEST="${LATEST_TAG#v}"
|
||||
NORMALIZED_LATEST="${NORMALIZED_LATEST#V}"
|
||||
if [ "$NORMALIZED_LATEST" != "$PACKAGE_VERSION" ]; then
|
||||
echo "Version mismatch"
|
||||
echo "create_release=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Version matches"
|
||||
echo "create_release=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Create new release
|
||||
if: env.create_release == 'true'
|
||||
run: |
|
||||
TAG_NAME="v$PACKAGE_VERSION"
|
||||
gh release create "$TAG_NAME" \
|
||||
--generate-notes \
|
||||
-t "$TAG_NAME"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "cwd-admin",
|
||||
"version": "0.0.2",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "cwd-api",
|
||||
"version": "0.0.2",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"deploy": "wrangler deploy",
|
||||
"dev": "wrangler dev",
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
saveEmailNotificationSettings
|
||||
} from './utils/email';
|
||||
import { loadFeatureSettings } from './utils/featureSettings';
|
||||
import packageJson from '../package.json';
|
||||
import packageJson from '../../package.json';
|
||||
|
||||
import { getComments } from './api/public/getComments';
|
||||
import { postComment } from './api/public/postComment';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "widget",
|
||||
"version": "0.0.2",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
16
package.json
Normal file
16
package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "cwd",
|
||||
"version": "0.0.1",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/anghunk/cwd"
|
||||
},
|
||||
"homepage": "https://cwd.js.org",
|
||||
"author": {
|
||||
"name": "anghunk<anghunk@gmail.com>"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/anghunk/cwd/issues"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user