-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update common CI files to latest version from networkservicemesh/cmd-…
…template@master networkservicemesh/cmd-template#27 networkservicemesh/cmd-template PR link: networkservicemesh/cmd-template#27 networkservicemesh/cmd-template commit message: commit 4dbacb1f83ec4076fd7ee481fcd4ea45310e545a Author: Denis Tingaikin <49399980+denis-tingajkin@users.noreply.github.com> Date: Sun Oct 25 22:01:59 2020 +0700 fix: cmd-template cannot update dependent repositories (#27) Signed-off-by: denis-tingajkin <denis.tingajkin@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
- Loading branch information
NSMBot
committed
Oct 25, 2020
1 parent
2fb6cae
commit 6ab11c4
Showing
3 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
name: Update dependent repositories | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
update-dependent-repositories: | ||
strategy: | ||
matrix: | ||
repository: [cmd-registry-proxy-dns, cmd-nsc, cmd-registry-memory, cmd-nsmgr, cmd-forwarder-vppagent, cmd-exclude-prefixes-k8s] | ||
name: Update ${{ matrix.repository }} | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'networkservicemesh/cmd-template' | ||
steps: | ||
- name: Checkout ${{ github.repository }} | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ${{ github.repository }} | ||
repository: ${{ github.repository }} | ||
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | ||
- name: Find merged PR | ||
uses: jwalton/gh-find-current-pr@v1 | ||
id: findPr | ||
with: | ||
github-token: ${{ github.token }} | ||
- name: Create commit message | ||
working-directory: ${{ github.repository }} | ||
run: | | ||
echo "Update common CI files to latest version from ${{ github.repository }}@master ${{ github.repository }}#${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message | ||
echo "" >> /tmp/commit-message | ||
echo "${{ github.repository }} PR link: https://github.com/${{ github.repository }}/pull/${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message | ||
echo "" >> /tmp/commit-message | ||
echo "${{ github.repository }} commit message:" >> /tmp/commit-message | ||
git log -1 >> /tmp/commit-message | ||
echo "Commit Message:" | ||
cat /tmp/commit-message | ||
- name: Checkout networkservicemesh/${{ matrix.repository }} | ||
uses: actions/checkout@v2 | ||
with: | ||
path: networkservicemesh/${{ matrix.repository }} | ||
repository: networkservicemesh/${{ matrix.repository }} | ||
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.15 | ||
- name: Push update to the ${{ matrix.repository }} | ||
working-directory: networkservicemesh/${{ matrix.repository }} | ||
run: | | ||
echo Starting to update repositotry ${{ matrix.repository }} | ||
git config --global user.email "nsmbot@networkservicmesh.io" | ||
git config --global user.name "NSMBot" | ||
git remote add cmd_template https://github.com/networkservicemesh/cmd-template.git | ||
git fetch cmd_template | ||
git diff cmd_template/master -R | git apply | ||
git add $(git ls-tree --name-only -r cmd_template/master | grep ".*\.yml\|.*\.yaml\|.*\.md\|.*\.txt\|.*.\.conf") | ||
if ! [ "$(git restore --staged -- .templateignore)" ]; then | ||
git restore -- .templateignore | ||
fi | ||
if ! [ "$(git restore --staged -- $(cat .templateignore))" ]; then | ||
git restore -- $(cat .templateignore) | ||
fi | ||
if ! [ -n "$(git diff --cached --exit-code)" ]; then | ||
exit 0; | ||
fi | ||
git commit -s -F /tmp/commit-message | ||
git checkout -b update/${{ github.repository }} | ||
git push -f origin update/${{ github.repository }} |