Skip to content

Sync antd data

Sync antd data #6

Workflow file for this run

name: Sync antd data
on:
schedule:
- cron: '37 8 * * *' # Daily at UTC 08:37 (Beijing 16:37)
workflow_dispatch: # Manual trigger
permissions:
contents: write
id-token: write # npm OIDC Trusted Publishing + provenance
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- name: Clone antd repo (shallow, filter tree)
run: |
git clone --filter=tree:0 --no-checkout \
https://github.com/ant-design/ant-design.git antd-source
- name: Sync v4, v5, v6 metadata
run: npx tsx scripts/sync.ts --antd-dir antd-source
- name: Commit, publish and tag if antd version changed
run: |
if [ -z "$(git status --porcelain data/)" ]; then
echo "No changes in data/, skipping release"
exit 0
fi
VERSIONS=""
for major in 4 5 6; do
if ! git diff --quiet "data/v${major}.json"; then
VER=$(node -p "JSON.parse(require('fs').readFileSync(\"data/v${major}.json\",'utf8')).version")
VERSIONS="${VERSIONS:+${VERSIONS}, }v${major}@${VER}"
fi
done
# Use antd v6 version as CLI version
CLI_VERSION=$(node -p "JSON.parse(require('fs').readFileSync('data/v6.json','utf8')).version")
# Update package.json version
npm version "$CLI_VERSION" --no-git-tag-version
# Build and test
npm run build
npm test
# Commit, tag and push
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add data/ package.json package-lock.json
git commit -m "data: sync antd metadata (${VERSIONS})"
git tag "v${CLI_VERSION}"
git push origin main --tags
# Publish to npm
npm publish --provenance --access public