-
-
Notifications
You must be signed in to change notification settings - Fork 1k
52 lines (49 loc) 路 2.08 KB
/
style-sync.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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