generated from networkservicemesh/cmd-template
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync files with networkservicemesh/cmd-template
This PR syncs files with https://github.com/networkservicemesh/cmd-template Revision: https://github.com/networkservicemesh/cmd-template/commits/0e918069285bad36f7f80e09185ce9b29408284d commit 0e918069285bad36f7f80e09185ce9b29408284d Author: Nikita Skrynnik <93182827+NikitaSkrynnik@users.noreply.github.com> Date: Mon Jan 24 11:07:06 2022 +0700 Fan-in NSM Releasing (#83) * implement fan-in releasing scenario Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com> * fix linter issue Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com> * switch to real branch names Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
- Loading branch information
NSMBot
committed
Jan 24, 2022
1 parent
a973a96
commit f9894f5
Showing
2 changed files
with
99 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
name: Release deployments-k8s repository | ||
on: | ||
push: | ||
branches: | ||
- "release/**" | ||
jobs: | ||
check-branch: | ||
name: Check release branch in deployments-k8s | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get tag | ||
run: | | ||
branch=${{ github.event.ref }} | ||
echo '::set-output name=tag::'${branch#refs/heads/release/} | ||
id: get-tag-step | ||
|
||
- name: Checkout networkservicemesh/deployments-k8s | ||
uses: actions/checkout@v2 | ||
with: | ||
path: networkservicemesh/deployments-k8s | ||
repository: networkservicemesh/deployments-k8s | ||
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | ||
|
||
- name: check-release-branch | ||
working-directory: networkservicemesh/deployments-k8s | ||
run: | | ||
echo Starting to check release branch in deployments-k8s repository | ||
branch=release/${{ steps.get-tag-step.outputs.tag }} | ||
echo branch to be checked - ${branch} | ||
if ! [ -z "$(git ls-remote --heads origin ${branch})" ]; then | ||
echo Branch ${branch} is already presented in deployments-k8s repository | ||
exit 0; | ||
fi | ||
echo Branch ${branch} is not presented in repository | ||
echo Starting to create ${branch} branch in deployments-k8s repository | ||
git config --global user.email "nsmbot@networkservicmesh.io" | ||
git config --global user.name "NSMBot" | ||
git checkout -b ${branch} | ||
git push -u origin ${branch} || exit 0; | ||
update-deployments-k8s: | ||
needs: check-branch | ||
name: Update deployments-k8s | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository != 'networkservicemesh/cmd-template' }} | ||
steps: | ||
- name: Get tag | ||
run: | | ||
branch=${{ github.event.ref }} | ||
echo '::set-output name=tag::'${branch#refs/heads/release/} | ||
id: get-tag-step | ||
|
||
- name: Checkout ${{ github.repository }} | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ${{ github.repository }} | ||
repository: ${{ github.repository }} | ||
|
||
- name: Create commit message | ||
working-directory: ${{ github.repository }} | ||
run: | | ||
echo "Update docker images to the latest tag ${{ steps.get-tag-step.outputs.tag }}" >> /tmp/commit-message | ||
echo "" >> /tmp/commit-message | ||
echo "Commit Message:" | ||
cat /tmp/commit-message | ||
- name: Checkout networkservicemesh/deployments-k8s | ||
uses: actions/checkout@v2 | ||
with: | ||
path: networkservicemesh/deployments-k8s | ||
repository: networkservicemesh/deployments-k8s | ||
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | ||
|
||
- name: Find and Replace ci/${{ github.repository }} version | ||
uses: jacobtomlinson/gha-find-replace@master | ||
with: | ||
find: "ci/${{ github.event.repository.name }}:.*\n" | ||
replace: "${{ github.event.repository.name }}:${{ steps.get-tag-step.outputs.tag }}\n" | ||
|
||
- name: Push update to the deployments-k8s | ||
working-directory: networkservicemesh/deployments-k8s | ||
run: | | ||
echo Starting to update repositotry deployments-k8s | ||
git add -- . | ||
if ! [ -n "$(git diff --cached --exit-code)" ]; then | ||
echo Repository already up to date | ||
exit 0; | ||
fi | ||
branch=release/${{ github.repository }}/${{ steps.get-tag-step.outputs.tag }} | ||
git config --global user.email "nsmbot@networkservicmesh.io" | ||
git config --global user.name "NSMBot" | ||
git commit -s -F /tmp/commit-message | ||
git checkout -b ${branch} | ||
git push -f origin ${branch} |