Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/check-repos-updates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env bash
echo "Stage1 Find Updates"
LATEST_RELEASE=$(curl -s https://api.github.com/repos/telerik/kendo-ui-core/releases | grep tag_name | head -n 1 | cut -d '"' -f 4)
LATEST_THEMES_RELEASE=$(curl -s https://api.github.com/repos/telerik/kendo-themes/releases | jq -r '[.[] | select(.prerelease == false)][0].name' | tr -d v)
echo "Last release version is $LATEST_RELEASE"
echo "Last Themes release version is $LATEST_THEMES_RELEASE"

function getCurrentVersion {
for file in `find . -type f -name "*.cshtml"`
do
CURRENT_VERSION=$(grep -hnr "kendo.cdn" $file | head -2 | tail -1 | cut -d '/' -f 4)
if [ ! -z "$CURRENT_VERSION" ]
then
CURRENT_GLOBAL_VERSION=$CURRENT_VERSION
fi
done
}

function getCurrentThemesVersion {
for file in `find . -type f -name "*.cshtml"`
do
CURRENT_THEMES_VERSION=$(grep -hnr "kendo.cdn" $file | head -1 | cut -d '/' -f 5)
if [ ! -z "$CURRENT_THEMES_VERSION" ]
then
CURRENT_GLOBAL_THEMES_VERSION=$CURRENT_THEMES_VERSION
fi
done
}
getCurrentVersion $file
getCurrentThemesVersion $file

echo "Current version is $CURRENT_GLOBAL_VERSION"
echo "Current themes version is $CURRENT_GLOBAL_THEMES_VERSION"


for file in `find . -type f -name "*.cshtml"`
do
sed -i "s/$CURRENT_GLOBAL_VERSION/$LATEST_RELEASE/g" $file
sed -i "s/$CURRENT_GLOBAL_THEMES_VERSION/$LATEST_THEMES_RELEASE/g" $file
done
for file in `find . -type f -name "*.csproj"`
do
sed -i "s/$CURRENT_GLOBAL_VERSION/$LATEST_RELEASE/g" $file
done
for file in `find . -type f -name "*.config"`
do
sed -i "s/$CURRENT_GLOBAL_VERSION/$LATEST_RELEASE/g" $file
done

echo "Stage2 Commit the change"
reviewers="Dimitar-Goshev"
echo $reviewers
BRANCH_NAME="update-dependencies"
PRs=$(gh pr list | grep "$BRANCH_NAME" || true)
echo "PRs are:"
echo $PRs
echo "Branch is:"
echo $BRANCH_NAME
if [ ! -z $PRs ]; then
echo "Unmerged pr $BRANCH_NAME"
else
git fetch origin
git pull
git checkout -b $BRANCH_NAME
git config user.email "kendo-bot@progress.com"
git config user.name "kendo-bot"
git add . && git commit -m "chore: update dependencies"
git pull
git push -u origin $BRANCH_NAME
gh pr create --base master --head $BRANCH_NAME --reviewer $reviewers \
--title "Update dependencies $DATE" --body 'Please review and update dependencies'

git diff
fi
18 changes: 18 additions & 0 deletions .github/workflows/check-repos-updates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Check for updates across repos and create pull request

on: workflow_dispatch
jobs:
check-repos-updates:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2
with:
repository: ${{ github.repository }}

- name: Clean up
run: rm -rf kendo-*
- name: Get repos deps
run: .github/workflows/check-repos-updates.sh ${{ secrets.GH_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}