-
Notifications
You must be signed in to change notification settings - Fork 3
55 lines (52 loc) · 2.16 KB
/
build.yml
File metadata and controls
55 lines (52 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Trigger Enterprise Build by RestApi
on:
push:
branches: ['master', 'release-v*.*.*', 'develop-v*.*.0', 'develop-v*.*']
pull_request:
branches: ['master', 'release-v*.*.*', 'develop-v*.*.0', 'develop-v*.*']
jobs:
Trigger:
runs-on: ubuntu-latest
steps:
# Set env
- name: Set Env if Push
if: ${{ github.event_name == 'push' }}
run: |
echo "ENTERPRISE_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "OPENSOURCE_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "CURRENT_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "TAG_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Set Env if Pull Request
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "ENTERPRISE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
echo "OPENSOURCE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
echo "CURRENT_BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "TAG_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
- name: Checkout Code to Get Author and Message
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Trigger by RestApi
run: |
author=`git log -1 --pretty=format:'%an'`
message=`git log -1 --pretty=%B`
time=`git log -1 --date=format:"%Y/%m/%d %T" --format="%ad"`
author_email=`git log -1 --format='%ae'`
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.TAPDATA_ENT_CICD_TOKEN }}" \
https://api.github.com/repos/tapdata/tapdata-enterprise/dispatches \
-d '{
"event_type": "frontend commit trigger",
"client_payload": {
"frontend_branch": "${{ env.CURRENT_BRANCH }}",
"opensource_branch": "${{ env.OPENSOURCE_BRANCH }}",
"current_branch": "${{ env.ENTERPRISE_BRANCH }}",
"commit_author": "'"${author}"'",
"commit_message": "'"${message}"'",
"commit_time": "'"${time}"'",
"commit_author_email": "'"${author_email}"'"
}
}'