Fixed ci config file for source sync job (#200)
[platform/core/csapi/xsf.git] / .circleci / config.yml
1 version: 2
2
3 jobs:
4
5   build-test:
6     docker:
7       - image: mcr.microsoft.com/dotnet/core/sdk:3.0
8     steps:
9       - checkout
10       - run: curl -sL https://art.sec.samsung.net/artifactory/tools/CircleCI/scripts/set_proxy_setting.sh | sh
11       - run: ./build.sh build
12
13   source-deployment:
14     docker:
15       - image: mcr.microsoft.com/dotnet/core/sdk:3.0
16     steps:
17       - checkout
18       - add_ssh_keys:
19          fingerprints:
20            - "c7:9c:e0:d3:5a:2a:4c:eb:e2:79:92:dc:87:74:b7:bd  "
21       - run:
22           command: |
23             mkdir -p ~/.ssh && echo "Host *" > ~/.ssh/config && echo " StrictHostKeyChecking no" >> ~/.ssh/config
24             git remote add spin ssh://jh0506.yun@165.213.149.170:29418/platform/core/csapi/xsf
25             git fetch spin
26             git push -f spin HEAD:tizen_wearable
27
28   source-sync:
29     docker:
30       - image: mcr.microsoft.com/dotnet/core/sdk:3.0
31     steps:
32       - checkout
33       - run:
34           command: |
35             git config --local user.name "TizenAPI-Bot"
36             git config --local user.email "tizenapi@samsung.com"
37             git checkout dev
38             git cherry-pick master
39             git push origin dev
40
41   build-nightly:
42     docker:
43       - image: mcr.microsoft.com/dotnet/core/sdk:3.0
44     steps:
45       - checkout
46       - run: curl -sL https://art.sec.samsung.net/artifactory/tools/CircleCI/scripts/set_proxy_setting.sh | sh
47       - run:
48           command: |
49             VERSION=$(./build.sh version nightly)
50             ./build.sh build
51             ./build.sh pack ${VERSION}
52       - persist_to_workspace:
53           root: .
54           paths:
55             - XSF.*.nupkg
56
57   build-release:
58     docker:
59       - image: mcr.microsoft.com/dotnet/core/sdk:3.0
60     steps:
61       - checkout
62       - run: curl -sL https://art.sec.samsung.net/artifactory/tools/CircleCI/scripts/set_proxy_setting.sh | sh
63       - run:
64           command: |
65             VERSION=$(echo ${CIRCLE_TAG} | sed -e "s/^v//")
66             ./build.sh build
67             ./build.sh pack ${VERSION}
68       - persist_to_workspace:
69           root: .
70           paths:
71             - XSF.*.nupkg
72
73   deploy:
74     docker:
75       - image: mcr.microsoft.com/dotnet/core/sdk:3.0
76     environment:
77       ART_URL: https://art.sec.samsung.net/artifactory
78     steps:
79       - checkout
80       - attach_workspace:
81           at: .
82       - run: curl -sL https://art.sec.samsung.net/artifactory/tools/CircleCI/scripts/set_proxy_setting.sh | sh
83       - run: curl -fL https://getcli.jfrog.io | sh
84       - run:
85           command: |
86             ./jfrog rt config --url ${ART_URL} --user ${ART_USER} --password ${ART_PASSWORD} --interactive=false
87             ./jfrog rt u XSF.*.nupkg dotnet_nuget --build-name=${CIRCLE_REPOSITORY_URL} --build-number=${CIRCLE_SHA1}
88             ./jfrog rt bag ${CIRCLE_REPOSITORY_URL} ${CIRCLE_SHA1} `realpath ${CIRCLE_WORKING_DIRECTORY}`
89             ./jfrog rt bp ${CIRCLE_REPOSITORY_URL} ${CIRCLE_SHA1}
90
91   github-release:
92     docker:
93       - image: cibuilds/github:0.10
94     environment:
95       GITHUB_API: https://github.sec.samsung.net/api/v3/
96     steps:
97       - attach_workspace:
98           at: .
99       - run:
100           command: |
101             ghr -t ${GITHUB_TOKEN} -u dotnet -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace ${CIRCLE_TAG} *.nupkg
102
103
104 workflows:
105   version: 2
106
107   commit:
108     jobs:
109       - build-test
110
111   deployment:
112     jobs:
113       - source-deployment:
114           filters:
115             branches:
116               only:
117                 - master
118
119   sync:
120     jobs:
121       - source-sync:
122           filters:
123             branches:
124               only:
125                 - master
126
127   nightly:
128     triggers:
129       - schedule:
130           cron: "0 15 * * *"
131           filters:
132             branches:
133               only:
134                 - master
135     jobs:
136       - build-nightly
137       - deploy:
138           requires:
139             - build-nightly
140
141   release:
142     jobs:
143       - build-release:
144           filters:
145             tags:
146               only: /^v[0-9]+.*/
147             branches:
148               ignore: /.*/
149       - deploy:
150           requires:
151             - build-release
152           filters:
153             tags:
154               only: /^v[0-9]+.*/
155             branches:
156               ignore: /.*/
157       - github-release:
158           requires:
159             - deploy
160           filters:
161             tags:
162               only: /^v[0-9]+.*/
163             branches:
164               ignore: /.*/
165
166
167