Skip to content

Commit

Permalink
Update from update/networkservicemesh/cmd-template
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmbot authored Dec 29, 2020
1 parent 1b3edaa commit cdf594a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 45 deletions.
60 changes: 19 additions & 41 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.31
version: v1.34.0

excludeFmtErrorf:
name: exclude fmt.Errorf
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
name: automerge
runs-on: ubuntu-latest
needs:
- update-integration-k8s-kind
- update-deployments-k8s
if: github.actor == 'nsmbot' && github.base_ref == 'master' && github.event_name == 'pull_request'
steps:
- name: Check out the code
Expand All @@ -209,10 +209,8 @@ jobs:
GITHUB_LOGIN: nsmbot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

update-integration-k8s-kind:
needs:
- pushImage
name: Update integration-k8s-kind
update-deployments-k8s:
name: Update deployments-k8s
runs-on: ubuntu-latest
if: github.repository != 'networkservicemesh/cmd-template' && github.actor == 'nsmbot' && github.base_ref == 'master' && github.event_name == 'pull_request'
steps:
Expand All @@ -222,23 +220,16 @@ jobs:
path: ${{ github.repository }}
repository: ${{ github.repository }}
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- name: Create branch name
working-directory: ${{ github.repository }}
run: |
diff=$(git diff --name-only)
BRANCH_NAME="${{ github.event.repository.name }}"
if [[ $(grep "go.mod" <<< "${diff}") && $(grep "" -c <<< "${diff}") == 2 ]]; then
sdkPattern="github.com\/networkservicemesh\/sdk "
sdkVersion=$(grep --regexp "${sdkPattern}" go.mod)
BRANCH_NAME="${sdkVersion:${#sdkPattern}}"
else
{
git push origin --delete update/"${BRANCH_NAME}"
} || {
echo Branch update/"${BRANCH_NAME}" is already deleted
}
fi;
echo BRANCH_NAME=${BRANCH_NAME} >> $GITHUB_ENV
- uses: benjlevesque/short-sha@v1.2
id: short-sha
with:
length: 8
- 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: Create commit message
working-directory: ${{ github.repository }}
run: |
Expand All @@ -250,25 +241,15 @@ jobs:
git log -1 >> /tmp/commit-message
echo "Commit Message:"
cat /tmp/commit-message
- name: Checkout networkservicemesh/integration-k8s-kind
uses: actions/checkout@v2
with:
path: networkservicemesh/integration-k8s-kind
repository: networkservicemesh/integration-k8s-kind
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- uses: benjlevesque/short-sha@v1.2
id: short-sha
with:
length: 8
- name: Find and Replace version
uses: jacobtomlinson/gha-find-replace@master
with:
find: "${{ github.event.repository.name }}:.*\n"
replace: "${{ github.event.repository.name }}:${{ steps.short-sha.outputs.sha }}\n"
- name: Push update to the integration-k8s-kind
working-directory: networkservicemesh/integration-k8s-kind
- name: Push update to the deployments-k8s
working-directory: networkservicemesh/deployments-k8s
run: |
echo Starting to update repositotry integration-k8s-kind
echo Starting to update repositotry deployments-k8s
git add -- .
if ! [ -n "$(git diff --cached --exit-code)" ]; then
echo Repository already up to date
Expand All @@ -277,8 +258,5 @@ jobs:
git config --global user.email "nsmbot@networkservicmesh.io"
git config --global user.name "NSMBot"
git commit -s -F /tmp/commit-message
git checkout -b update/"${BRANCH_NAME}"
while [ $(git push origin update/"${BRANCH_NAME}") ]; do
git fetch origin update/"${BRANCH_NAME}"
git rebase origin/update/"${BRANCH_NAME}"
done
git checkout -b update/${{ github.repository }}
git push -f origin update/${{ github.repository }}
5 changes: 1 addition & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ linters-settings:
goheader:
template-path: ".license/template.txt"
values:
const:
year: 2020
regexp:
year-range: ((\d\d\d\d-{{year}})|({{year}}))
company: .*
copyright-holder: Copyright \(c\) {{year-range}} {{company}}\n\n
copyright-holder: Copyright \(c\) ({{year-range}}) {{company}}\n\n
copyright-holders: ({{copyright-holder}})+
errcheck:
check-type-assertions: false
Expand Down

0 comments on commit cdf594a

Please sign in to comment.