Просмотр исходного кода

chore(CI): add git syne workflow

zhanghongtong 4 лет назад
Родитель
Сommit
cd4614876a
2 измененных файлов с 31 добавлено и 2 удалено
  1. 2 2
      .github/workflows/build_packages.yaml
  2. 29 0
      .github/workflows/git_sync.yaml

+ 2 - 2
.github/workflows/build_packages.yaml

@@ -356,7 +356,7 @@ jobs:
       if: github.event_name == 'release'
       run: |
         curl --silent --show-error \
-          -H "Authorization: token ${{ secrets.AccessToken }}" \
+          -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
           -H "Accept: application/vnd.github.v3+json" \
           -X POST \
           -d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ce\": \"true\"}}" \
@@ -366,7 +366,7 @@ jobs:
       run: |
         if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
             curl --silent --show-error \
-              -H "Authorization: token ${{ secrets.AccessToken }}" \
+              -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
               -H "Accept: application/vnd.github.v3+json" \
               -X POST \
               -d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\"}}" \

+ 29 - 0
.github/workflows/git_sync.yaml

@@ -0,0 +1,29 @@
+name: Sync to enterprise
+
+on:
+  push:
+    branches:
+      - master
+
+jobs:
+  sync_to_enterprise:
+    runs-on: ubuntu-20.04
+    if: github.repository == 'emqx/emqx'
+    steps:
+      - name: git-sync
+        uses: Rory-Z/git-sync@v3.0.1
+        with:
+          source_repo: ${{ github.repository }}
+          source_branch: ${{ github.ref }}
+          destination_repo: "${{ github.repository_owner }}/emqx-enterprise"
+          destination_branch: ${{ github.ref }}
+          destination_ssh_private_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}"
+      - name: create pull request
+        run: |
+          set -euo pipefail
+          curl --silent --show-error \
+          -H "Accept: application/vnd.github.v3+json" \
+          -H "Authorization: token ${{ secrets.CI_GIT_TOEKN }}" \
+          -X POST \
+          -d '{"title": "Sync code into enterprise from opensource", "head": "master", "base":"enterprise"}' \
+          https://api.github.com/repos/${{ github.repository_owner }}/emqx-enterprise/pulls