This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
merge_group:
|
||||
branches: ["main"]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Config Git User
|
||||
run: |
|
||||
git config --local user.name "dragooncjw"
|
||||
git config --local user.email "289056872@qq.com"
|
||||
- name: For Debug
|
||||
run: |
|
||||
echo "Listing files in the root directory:"
|
||||
ls -alh
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
# - name: Verify Change Logs
|
||||
# run: node common/scripts/install-run-rush.js change --verify
|
||||
- name: Rush Install
|
||||
run: node common/scripts/install-run-rush.js install
|
||||
- name: Rush build
|
||||
run: node common/scripts/install-run-rush.js build
|
||||
- name: Check Lint
|
||||
run: node common/scripts/install-run-rush.js lint --verbose
|
||||
- name: Check TS
|
||||
run: node common/scripts/install-run-rush.js ts-check
|
||||
- name: Test (coverage)
|
||||
run: node common/scripts/install-run-rush.js test:cov
|
||||
@@ -0,0 +1,39 @@
|
||||
name: PR Common Checks
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
common-checks:
|
||||
name: PR Common Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Config Git User
|
||||
run: |
|
||||
git config --local user.name "tecvan"
|
||||
git config --local user.email "fanwenjie.fe@bytedance.com"
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Install Dependencies
|
||||
run: node common/scripts/install-run-rush.js install
|
||||
|
||||
# PR Title Format Check
|
||||
- name: Check PR Title Format
|
||||
if: ${{ !contains(github.event.pull_request.title, 'WIP') && !contains(github.event.pull_request.title, 'wip') }}
|
||||
env:
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
run: |
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name rush-commitlint && \
|
||||
pushd common/autoinstallers/rush-commitlint && \
|
||||
echo "$PR_TITLE" | npx commitlint --config commitlint.config.js && \
|
||||
popd
|
||||
|
||||
# Add more common checks here
|
||||
# For example: file size checks, specific file format validations, etc.
|
||||
@@ -0,0 +1,75 @@
|
||||
name: Deploy With Actions
|
||||
on: workflow_dispatch
|
||||
|
||||
concurrency:
|
||||
group: "main-deploy-branch-workflow"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
persist-credentials: true
|
||||
|
||||
- name: Config Git User
|
||||
run: |
|
||||
git config --local user.name "dragooncjw"
|
||||
git config --local user.email "289056872@qq.com"
|
||||
|
||||
- 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 -t @flowgram.ai/docs
|
||||
|
||||
- name: Rush build
|
||||
run: node common/scripts/install-run-rush.js build -t @flowgram.ai/docs
|
||||
|
||||
- name: Generate docs
|
||||
run: |
|
||||
cd apps/docs
|
||||
npm run docs
|
||||
|
||||
- name: Copy auto-docs to en
|
||||
run: cp -r apps/docs/src/zh/auto-docs apps/docs/src/en/auto-docs
|
||||
|
||||
- name: Build Doc site
|
||||
run: |
|
||||
cd apps/docs
|
||||
npm run build
|
||||
|
||||
- name: Replace docs
|
||||
run: |
|
||||
rm -rf docs
|
||||
mv apps/docs/doc_build docs
|
||||
|
||||
# 🔥 新增步骤:在 docs 目录下生成 vercel.json
|
||||
- name: Create vercel.json
|
||||
run: |
|
||||
cat > docs/vercel.json <<EOF
|
||||
{
|
||||
"version": 2,
|
||||
"buildCommand": "",
|
||||
"outputDirectory": ".",
|
||||
"cleanUrls": true,
|
||||
"trailingSlash": false
|
||||
}
|
||||
EOF
|
||||
|
||||
# 🔥 推送到 gh-pages 分支
|
||||
- name: Push to gh-pages branch
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs
|
||||
publish_branch: gh-pages
|
||||
force: true
|
||||
@@ -0,0 +1,39 @@
|
||||
name: E2E Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
merge_group:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Rush Install
|
||||
run: node common/scripts/install-run-rush.js install
|
||||
|
||||
- name: Rush build
|
||||
run: node common/scripts/install-run-rush.js build
|
||||
|
||||
# 缓存 Playwright 浏览器
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('e2e/fixed-layout/package.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-playwright-
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: pushd e2e/fixed-layout && npx playwright install --with-deps --only-shell chromium && popd
|
||||
|
||||
- name: Run E2E tests
|
||||
run: node common/scripts/install-run-rush.js e2e:test --verbose
|
||||
@@ -0,0 +1,196 @@
|
||||
name: Publish
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
publish-type:
|
||||
description: "发布类型"
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- sdk-patch
|
||||
- sdk-minor
|
||||
- sdk-alpha
|
||||
- sdk-to-version
|
||||
- app-patch
|
||||
- app-to-version
|
||||
sdk-version:
|
||||
description: "指定版本号(仅 sdk-to-version / app-to-version 时需要,e.g. 1.0.0)"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
concurrency:
|
||||
group: "publish-workflow"
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Config Git User
|
||||
run: |
|
||||
git config --local user.name "dragooncjw"
|
||||
git config --local user.email "289056872@qq.com"
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Upgrade npm for OIDC support
|
||||
run: |
|
||||
npm install -g npm@latest
|
||||
npm --version
|
||||
|
||||
- name: Determine version and publish parameters
|
||||
id: params
|
||||
run: |
|
||||
PUBLISH_TYPE="${{ github.event.inputs.publish-type }}"
|
||||
INPUT_VERSION="${{ github.event.inputs.sdk-version }}"
|
||||
|
||||
case "$PUBLISH_TYPE" in
|
||||
sdk-patch)
|
||||
LATEST_VERSION=$(npm view @flowgram.ai/core version --tag=latest latest)
|
||||
POLICY_NAME="publishPolicy"
|
||||
NEXT_BUMP="patch"
|
||||
NPM_TAG="latest"
|
||||
USE_OVERRIDE="false"
|
||||
;;
|
||||
sdk-minor)
|
||||
LATEST_VERSION=$(npm view @flowgram.ai/core version --tag=latest latest)
|
||||
POLICY_NAME="publishPolicy"
|
||||
NEXT_BUMP="minor"
|
||||
NPM_TAG="latest"
|
||||
USE_OVERRIDE="false"
|
||||
;;
|
||||
sdk-alpha)
|
||||
LATEST_VERSION=$(npm view @flowgram.ai/core version --tag=alpha latest 2>/dev/null || true)
|
||||
if [ -z "$LATEST_VERSION" ]; then
|
||||
LATEST_VERSION="0.1.0-alpha.1"
|
||||
echo "Version not found, using default: $LATEST_VERSION"
|
||||
fi
|
||||
POLICY_NAME="publishPolicy"
|
||||
NEXT_BUMP="prerelease"
|
||||
NPM_TAG="alpha"
|
||||
USE_OVERRIDE="true"
|
||||
;;
|
||||
sdk-to-version)
|
||||
if [ -z "$INPUT_VERSION" ]; then
|
||||
echo "::error::sdk-version is required for sdk-to-version"
|
||||
exit 1
|
||||
fi
|
||||
LATEST_VERSION="$INPUT_VERSION"
|
||||
POLICY_NAME="publishPolicy"
|
||||
NEXT_BUMP=""
|
||||
NPM_TAG="latest"
|
||||
USE_OVERRIDE="true"
|
||||
;;
|
||||
app-patch)
|
||||
LATEST_VERSION=$(npm view @flowgram.ai/demo-fixed-layout version --tag=latest latest)
|
||||
POLICY_NAME="appPolicy"
|
||||
NEXT_BUMP="patch"
|
||||
NPM_TAG="latest"
|
||||
USE_OVERRIDE="false"
|
||||
;;
|
||||
app-to-version)
|
||||
if [ -z "$INPUT_VERSION" ]; then
|
||||
echo "::error::sdk-version is required for app-to-version"
|
||||
exit 1
|
||||
fi
|
||||
LATEST_VERSION="$INPUT_VERSION"
|
||||
POLICY_NAME="appPolicy"
|
||||
NEXT_BUMP=""
|
||||
NPM_TAG="latest"
|
||||
USE_OVERRIDE="true"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
|
||||
echo "POLICY_NAME=$POLICY_NAME" >> $GITHUB_ENV
|
||||
echo "NEXT_BUMP=$NEXT_BUMP" >> $GITHUB_ENV
|
||||
echo "NPM_TAG=$NPM_TAG" >> $GITHUB_ENV
|
||||
echo "USE_OVERRIDE=$USE_OVERRIDE" >> $GITHUB_ENV
|
||||
echo "PUBLISH_TYPE=$PUBLISH_TYPE" >> $GITHUB_ENV
|
||||
|
||||
- name: Echo version
|
||||
run: |
|
||||
echo "Publish type: $PUBLISH_TYPE"
|
||||
echo "The package version is: $LATEST_VERSION"
|
||||
echo "Policy: $POLICY_NAME, Next bump: $NEXT_BUMP, Tag: $NPM_TAG"
|
||||
|
||||
- name: Rush Install
|
||||
run: node common/scripts/install-run-rush.js install
|
||||
|
||||
- name: Rush build
|
||||
run: node common/scripts/install-run-rush.js build
|
||||
|
||||
- name: Sync versions
|
||||
run: |
|
||||
if [ -n "$NEXT_BUMP" ]; then
|
||||
echo "[
|
||||
{
|
||||
\"policyName\": \"$POLICY_NAME\",
|
||||
\"definitionName\": \"lockStepVersion\",
|
||||
\"version\": \"$LATEST_VERSION\",
|
||||
\"nextBump\": \"$NEXT_BUMP\"
|
||||
}
|
||||
]" > common/config/rush/version-policies.json
|
||||
else
|
||||
echo "[
|
||||
{
|
||||
\"policyName\": \"$POLICY_NAME\",
|
||||
\"definitionName\": \"lockStepVersion\",
|
||||
\"version\": \"$LATEST_VERSION\"
|
||||
}
|
||||
]" > common/config/rush/version-policies.json
|
||||
fi
|
||||
|
||||
- name: Version Bump (override)
|
||||
if: env.USE_OVERRIDE == 'true'
|
||||
run: node common/scripts/install-run-rush.js version --ensure-version-policy --override-version=$LATEST_VERSION --version-policy=$POLICY_NAME
|
||||
|
||||
- name: Version Bump
|
||||
if: env.USE_OVERRIDE == 'false'
|
||||
run: node common/scripts/install-run-rush.js version --bump --version-policy $POLICY_NAME
|
||||
|
||||
# For alpha, we need both override and bump
|
||||
- name: Version Bump (alpha additional bump)
|
||||
if: env.PUBLISH_TYPE == 'sdk-alpha'
|
||||
run: node common/scripts/install-run-rush.js version --bump --version-policy $POLICY_NAME
|
||||
|
||||
- name: Publish
|
||||
run: node common/scripts/install-run-rush.js publish --include-all -p --tag $NPM_TAG
|
||||
|
||||
- name: Print npm debug logs on failure
|
||||
if: failure()
|
||||
run: |
|
||||
echo "=== npm debug logs ==="
|
||||
find "$GITHUB_WORKSPACE/common/temp/publish-home/.npm/_logs" -name '*.log' -exec echo "--- {} ---" \; -exec cat {} \; 2>/dev/null || echo "No npm debug logs found"
|
||||
|
||||
- name: Get new Version
|
||||
id: get_new_version
|
||||
if: env.PUBLISH_TYPE != 'app-patch'
|
||||
run: |
|
||||
if [ "$NPM_TAG" = "alpha" ]; then
|
||||
NEW_VERSION=$(npm view @flowgram.ai/core version --tag=alpha latest)
|
||||
else
|
||||
NEW_VERSION=$(npm view @flowgram.ai/core version --tag=latest latest)
|
||||
fi
|
||||
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Create tag
|
||||
if: env.PUBLISH_TYPE != 'app-patch'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
git tag "v$NEW_VERSION"
|
||||
git push origin "v$NEW_VERSION"
|
||||
@@ -0,0 +1,48 @@
|
||||
name: Sync Screenshot
|
||||
on: workflow_dispatch
|
||||
|
||||
concurrency:
|
||||
group: "manual-sync-screenshot"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
# can not update screenshot run on main.
|
||||
if: github.ref_name != 'main'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Set Git user.name and user.email from trigger actor
|
||||
run: |
|
||||
git config --global user.name "${{ github.actor }}"
|
||||
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
|
||||
|
||||
- name: Rush Install
|
||||
run: node common/scripts/install-run-rush.js install
|
||||
|
||||
- name: Rush build
|
||||
run: node common/scripts/install-run-rush.js build
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps
|
||||
|
||||
- name: Run E2E tests
|
||||
run: node common/scripts/install-run-rush.js e2e:update-screenshot --verbose
|
||||
|
||||
- name: Commit and push changes
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
git add .
|
||||
if git diff-index --quiet HEAD; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
git commit -m "chore: sync screenshot"
|
||||
git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }} HEAD:${{ github.ref_name }}
|
||||
fi
|
||||
Reference in New Issue
Block a user