chore: apps publish with appPolicy

This commit is contained in:
dragooncjw 2025-02-24 19:30:28 +08:00
parent a9a24145a0
commit 20f7205dd8
4 changed files with 71 additions and 10 deletions

59
.github/workflows/publish-app.yml vendored Normal file
View File

@ -0,0 +1,59 @@
name: Publish
on:
workflow_dispatch
concurrency:
group: "main-branch-workflow" # 唯一标识符,确保只运行一个实例
cancel-in-progress: false # 不取消正在运行的实例,后续触发需要等待当前实例完成
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up npm token
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
- name: Debug Auth
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
npm whoami
- name: Get latest npm version
id: get_version
run: |
LATEST_VERSION=$(npm view @flowgram.ai/demo-fixed-layout version --tag=latest latest)
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
echo "::set-output name=version::$LATEST_VERSION"
- name: Echo version
run: |
echo "The package version is : $LATEST_VERSION"
echo "The package output version is ${{ steps.get_version.outputs.version }}"
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org/'
- name: Rush Install
run: node common/scripts/install-run-rush.js install
- name: Rush build
run: node common/scripts/install-run-rush.js build
# version bump 之前保证是远端最新的,这样无需 commit package.json version
- name: Sync versions
run: |
echo "[
{
\"policyName\": \"appPolicy\",
\"definitionName\": \"lockStepVersion\",
\"version\": \"$LATEST_VERSION\",
\"nextBump\": \"patch\"
}
]" > common/config/rush/version-policies.json
- name: Version Bump
run: node common/scripts/install-run-rush.js version --bump
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: node common/scripts/install-run-rush.js publish --version-policy appPolicy -p --tag latest

View File

@ -22,10 +22,6 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
npm whoami
- name: Config Git User
run: |
git config --local user.name "chenjiawei.inizio"
git config --local user.email "chenjiawei.inizio@bytedance.com"
- name: Get latest npm version
id: get_version
run: |
@ -60,4 +56,4 @@ jobs:
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: node common/scripts/install-run-rush.js publish --include-all -p --tag latest
run: node common/scripts/install-run-rush.js publish --version-policy publishPolicy -p --tag latest

View File

@ -3,6 +3,12 @@
"policyName": "publishPolicy",
"definitionName": "lockStepVersion",
"version": "0.1.0",
"nextBump": "minor"
"nextBump": "patch"
},
{
"policyName": "appPolicy",
"definitionName": "lockStepVersion",
"version": "0.1.0",
"nextBump": "patch"
}
]

View File

@ -465,7 +465,7 @@
"packageName": "@flowgram.ai/demo-fixed-layout",
"projectFolder": "apps/demo-fixed-layout",
"tags": [ "level-1", "team-flow", "demo" ],
"versionPolicyName": "publishPolicy"
"versionPolicyName": "appPolicy"
},
{
"packageName": "@flowgram.ai/utils",
@ -753,12 +753,12 @@
"team-flow",
"demo"
],
"versionPolicyName": "publishPolicy"
"versionPolicyName": "appPolicy"
},
{
"packageName": "@flowgram.ai/demo-fixed-layout-simple",
"projectFolder": "apps/demo-fixed-layout-simple",
"versionPolicyName": "publishPolicy",
"versionPolicyName": "appPolicy",
"tags": [
"level-1",
"team-flow",
@ -768,7 +768,7 @@
{
"packageName": "@flowgram.ai/demo-free-layout-simple",
"projectFolder": "apps/demo-free-layout-simple",
"versionPolicyName": "publishPolicy",
"versionPolicyName": "appPolicy",
"tags": [
"level-1",
"team-flow",