diff --git a/.github/workflows/automerge.yaml b/.github/workflows/automerge.yaml index b997112..6e50fb8 100644 --- a/.github/workflows/automerge.yaml +++ b/.github/workflows/automerge.yaml @@ -27,56 +27,3 @@ jobs: GITHUB_LOGIN: nsmbot ENABLED_FOR_MANUAL_CHANGES: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - update-deployments-k8s: - name: Update deployments-k8s - runs-on: ubuntu-latest - needs: - - pushImage - if: ${{ github.event.workflow_run.conclusion == 'success' }} && github.actor == 'nsmbot' - steps: - - name: Checkout ${{ github.repository }} - uses: actions/checkout@v2 - with: - path: ${{ github.repository }} - repository: ${{ github.repository }} - token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} - - 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: | - echo "Update application version to latest version from ${{ github.repository }}@master ${{ github.repository }}#${{ github.event.number }}" > /tmp/commit-message - echo "" >> /tmp/commit-message - echo "${{ github.repository }} PR link: https://github.com/${{ github.repository }}/pull/${{ github.event.number }}" >> /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: 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 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 - 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/${{ github.repository }} - git push -f origin update/${{ github.repository }} diff --git a/.github/workflows/update-cmd-repositories.yaml b/.github/workflows/update-cmd-repositories.yaml deleted file mode 100644 index ef0de59..0000000 --- a/.github/workflows/update-cmd-repositories.yaml +++ /dev/null @@ -1,80 +0,0 @@ ---- -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 - - cmd-forwarder-sriov - - cmd-nse-icmp-responder - 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.16 - - 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 - if [ ! -f .templateignore ]; then - touch .templateignore - git add .templateignore - fi - 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") - git restore -- .templateignore - while read -r line || [[ -n "$line" ]]; do - git restore --staged -- $line - git restore -- $line - done < .templateignore - 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 }} diff --git a/.github/workflows/update-deployments.yaml b/.github/workflows/update-deployments.yaml index a6bdba0..1308c4a 100644 --- a/.github/workflows/update-deployments.yaml +++ b/.github/workflows/update-deployments.yaml @@ -4,12 +4,17 @@ on: push: branches: - master - + workflow_run: + types: + - completed + workflows: + - 'automerge' jobs: update-deployments-k8s: name: Update deployments-k8s runs-on: ubuntu-latest - if: github.repository != 'networkservicemesh/cmd-template' + + if: ${{ github.repository != 'networkservicemesh/cmd-template' && (github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' || github.ref == 'refs/heads/master') }} steps: - name: Checkout ${{ github.repository }} uses: actions/checkout@v2