mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 09:21:24 +08:00
53 lines
2.1 KiB
YAML
53 lines
2.1 KiB
YAML
name: Style sync Bot
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0/30 * * * *"
|
|
|
|
jobs:
|
|
style-sync:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository_owner == 'ant-design-blazor'
|
|
|
|
steps:
|
|
- name: Sync styles from ant-design
|
|
shell: bash
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.GH_PUSH_TOKEN}}
|
|
run: |
|
|
git clone https://github.com/ant-design/ant-design.git
|
|
git clone https://github.com/ant-design-blazor/ant-design-blazor.git
|
|
cd ant-design
|
|
LAST_VERSION=$(git describe --abbrev=0 --tags | sed 's/* //' )
|
|
echo "Last Version of ant-design: ${LAST_VERSION}"
|
|
git checkout ${LAST_VERSION}
|
|
cd ../ant-design-blazor
|
|
git checkout feature
|
|
BRANCH_NAME="sync-style/${LAST_VERSION}"
|
|
if [ $( git branch -a | egrep "remotes/origin/${BRANCH_NAME}" | wc -l) -gt 0 ]; then
|
|
echo "Branch ${BRANCH_NAME} already exists."
|
|
exit 0
|
|
fi
|
|
echo "Creating a new branch ${BRANCH_NAME} ..."
|
|
git checkout -b ${BRANCH_NAME}
|
|
cd ../ant-design
|
|
echo "Synchronizing the sytle flies to ant-design-blazor..."
|
|
find ./components/ -name '*.less' -exec cp --parents -a '{}' '../ant-design-blazor/' ';'
|
|
cd ../ant-design-blazor
|
|
TOTAL_MODIFIED=$(git status -s | wc -l)
|
|
if [ "$TOTAL_MODIFIED" -eq "0" ]; then
|
|
echo "nothing modified"
|
|
exit 0
|
|
fi
|
|
echo "Total modified: ${TOTAL_MODIFIED}"
|
|
git config --global user.name 'ElderJames'
|
|
git config --global user.email 'shunjiey@hotmail.com'
|
|
git add -A
|
|
git commit -m "chore: sync ant-design v${LAST_VERSION}"
|
|
git push https://ElderJames:$GITHUB_TOKEN@github.com/ant-design-blazor/ant-design-blazor.git ${BRANCH_NAME}
|
|
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
|
|
cat>PR<<EOF
|
|
chore: sync ant-design v${LAST_VERSION}
|
|
EOF
|
|
bin/hub pull-request -F PR -b ant-design-blazor:feature -h ant-design-blazor:${BRANCH_NAME} -a ElderJames
|