chore(CI): add git syne workflow

This commit is contained in:
zhanghongtong 2021-03-05 16:24:07 +08:00 committed by Rory Z
parent b2d75b3837
commit cd4614876a
2 changed files with 31 additions and 2 deletions

View File

@ -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
.github/workflows/git_sync.yaml vendored Normal file
View File

@ -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