-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
76 lines (61 loc) · 1.89 KB
/
azure-pipelines.yml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
trigger:
tags:
include:
- "v*"
resources:
containers:
- container: node18
image: node:18-buster
pool:
docker
variables:
- group: pipeline
jobs:
- job: GitHubSync
container: node18
steps:
- checkout: self
- script: |
if [ "$(Build.SourceBranch)" != "refs/tags/*" ]; then
echo "This is a tag push. Sync starting..."
BRANCH_NAME=main
git config --global user.email "jigar.dafda@gmail.com"
git config --global user.name "Jigar Dafda"
git clone https://$(GITHUB_USERNAME):$(GITHUB_PERSONAL_TOKEN)@github.com/gofynd/fdk-store-gql.git
cd fdk-store-gql
git checkout $BRANCH_NAME
rm -rf ./*
cd ..
cp -R `ls | grep -v "fdk-store-gql"` ./fdk-store-gql
cp .gitignore.ci ./fdk-store-gql/.gitignore
cd fdk-store-gql
NODE_ENV=development npm i
npm run build
git add .
git commit -m "[Auto Generated]"
git push origin $BRANCH_NAME
git tag $(Build.SourceBranchName)
git push origin $(Build.SourceBranchName)
# Create GitHub release
RELEASE_TITLE="Release_$(Build.SourceBranchName)"
echo $(Build.SourceBranchName)
echo $RELEASE_TITLE
echo $BRANCH_NAME
POST_DATA=$(printf '{
"tag_name": "%s",
"target_commitish": "%s",
"name": "%s",
"body": "%s",
"draft": false,
"prerelease": false
}' $(Build.SourceBranchName) $BRANCH_NAME $RELEASE_TITLE "$RELEASE_TITLE")
echo $POST_DATA
curl -X POST -H "Authorization: token $(GITHUB_PERSONAL_TOKEN)" \
-H "Content-Type: application/json" \
-d "$POST_DATA" \
"https://api.github.com/repos/gofynd/fdk-store-gql/releases"
else
echo "This is not a tag push. Exiting..."
exit 0
fi
displayName: 'Sync with GitHub'