Skip to content

Commit 1322f0b

Browse files
committed
chore: update action
1 parent 18e7b64 commit 1322f0b

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env bash
2+
echo "Stage1 Find Updates"
3+
LATEST_RELEASE=$(curl -s https://api.github.com/repos/telerik/kendo-ui-core/releases | grep tag_name | head -n 1 | cut -d '"' -f 4)
4+
LATEST_THEMES_RELEASE=$(curl -s https://api.github.com/repos/telerik/kendo-themes/releases | grep -B4 '"prerelease": false' | head -1 | cut -d '"' -f 4 | tr -d v)
5+
echo "Last release version is $LATEST_RELEASE"
6+
echo "Last Themes release version is $LATEST_THEMES_RELEASE"
7+
8+
function getCurrentVersion {
9+
for file in `find . -type f -name "*.cshtml"`
10+
do
11+
CURRENT_VERSION=$(grep -hnr "kendo.cdn" $file | head -2 | tail -1 | cut -d '/' -f 4)
12+
if [ ! -z "$CURRENT_VERSION" ]
13+
then
14+
CURRENT_GLOBAL_VERSION=$CURRENT_VERSION
15+
fi
16+
done
17+
}
18+
19+
function getCurrentThemesVersion {
20+
for file in `find . -type f -name "*.cshtml"`
21+
do
22+
CURRENT_THEMES_VERSION=$(grep -hnr "kendo.cdn" $file | head -1 | cut -d '/' -f 5)
23+
if [ ! -z "$CURRENT_THEMES_VERSION" ]
24+
then
25+
CURRENT_GLOBAL_THEMES_VERSION=$CURRENT_THEMES_VERSION
26+
fi
27+
done
28+
}
29+
getCurrentVersion $file
30+
getCurrentThemesVersion $file
31+
32+
echo "Current version is $CURRENT_GLOBAL_VERSION"
33+
echo "Current themes version is $CURRENT_GLOBAL_THEMES_VERSION"
34+
35+
36+
for file in `find . -type f -name "*.cshtml"`
37+
do
38+
sed -i "s/$CURRENT_GLOBAL_VERSION/$LATEST_RELEASE/g" $file
39+
sed -i "s/$CURRENT_GLOBAL_THEMES_VERSION/$LATEST_THEMES_RELEASE/g" $file
40+
done
41+
for file in `find . -type f -name "*.csproj"`
42+
do
43+
sed -i "s/$CURRENT_GLOBAL_VERSION/$LATEST_RELEASE/g" $file
44+
done
45+
for file in `find . -type f -name "*.config"`
46+
do
47+
sed -i "s/$CURRENT_GLOBAL_VERSION/$LATEST_RELEASE/g" $file
48+
done
49+
50+
echo "Stage2 Commit the change"
51+
reviewers="Dimitar-Goshev"
52+
echo $reviewers
53+
BRANCH_NAME="update-dependencies"
54+
PRs=$(gh pr list | grep "$BRANCH_NAME" || true)
55+
echo "PRs are:"
56+
echo $PRs
57+
echo "Branch is:"
58+
echo $BRANCH_NAME
59+
if [ ! -z $PRs ]; then
60+
echo "Unmerged pr $BRANCH_NAME"
61+
else
62+
git fetch origin
63+
git pull
64+
git checkout -b $BRANCH_NAME
65+
git config user.email "[email protected]"
66+
git config user.name "kendo-bot"
67+
git add . && git commit -m "chore: update dependencies"
68+
git pull
69+
git push -u origin $BRANCH_NAME
70+
gh pr create --base master --head $BRANCH_NAME --reviewer $reviewers \
71+
--title "Update dependencies $DATE" --body 'Please review and update dependencies'
72+
73+
git diff
74+
fi
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Check for updates across repos and create pull request
2+
3+
on: workflow_dispatch
4+
jobs:
5+
check-repos-updates:
6+
runs-on: ubuntu-latest
7+
steps:
8+
9+
- uses: actions/checkout@v2
10+
with:
11+
repository: ${{ github.repository }}
12+
13+
- name: Clean up
14+
run: rm -rf kendo-*
15+
- name: Get repos deps
16+
run: .github/workflows/check-repos-updates.sh ${{ secrets.GH_TOKEN }}
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)