67
67
- run :
68
68
name : syetem test
69
69
command : ./test
70
- build :
70
+ build_library :
71
71
working_directory : /tmp/build
72
72
docker :
73
73
- image : rhikimochi/opencv-docker:v0.14
88
88
working_directory : ~/build
89
89
machine : true
90
90
environment :
91
- DOCKER_USER : lifullsetg # After publish, move to circle environment variable.
92
- DOCKER_REPO : gazo-san
91
+ DOCKER_HUB_REPO : gazo-san
93
92
steps :
94
93
- checkout
95
94
- attach_workspace :
@@ -98,44 +97,61 @@ jobs:
98
97
name : Move library
99
98
command : mv /tmp/build/libimageDiffCalc.a ~/build/
100
99
- run :
101
- name : Build image
102
- command : docker build -t "$DOCKER_HUB_USER"/"$DOCKER_REPO":"${CIRCLE_TAG/v/}" .
103
- # - run:
104
- # name: Login docker hub
105
- # command: docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_TOKEN"
106
- # - run:
107
- # name: Push image
108
- # command: docker push "$DOCKER_HUB_USER"/"$DOCKER_REPO":"${CIRCLE_TAG/v/}"
109
- # - run:
110
- # name: Logout docker
111
- # command: docker logout
100
+ name : Build and tagged image
101
+ command : |
102
+ docker build -t "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":"${CIRCLE_TAG/v/}" .
103
+ docker tag "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":"${CIRCLE_TAG/v/}" "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":latest
104
+ - run :
105
+ name : Login docker hub
106
+ command : docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_TOKEN"
107
+ - run :
108
+ name : Push image
109
+ command : |
110
+ docker push "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":"${CIRCLE_TAG/v/}"
111
+ docker push "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":latest
112
+ - run :
113
+ name : Logout docker
114
+ command : docker logout
112
115
deploy_library :
113
116
working_directory : ~/deploy
114
117
docker :
115
118
- image : circleci/node:stretch
119
+ environment :
120
+ OWNER : lifull-dev
121
+ REPO : Gazo-san
122
+ UPLOAD_FILE : /tmp/build/libimageDiffCalc.a
116
123
steps :
117
124
- attach_workspace :
118
125
at : /tmp/build
119
- - run : echo "release process"
126
+ - run :
127
+ name : Store upload url and upload assets
128
+ command : |
129
+ UPLOAD_URL_RAW=$(curl -X GET -H "Authorization: token $GITHUB_TOKEN" \
130
+ "https://api.github.com/repos/$OWNER/$REPO/releases/tags/$CIRCLE_TAG" \
131
+ | jq '.upload_url')
132
+ UPLOAD_URL=$(echo ${UPLOAD_URL_RAW%\{*} | tr -d \")
133
+ curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
134
+ -H "Content-Type: $(file -b --mime-type $UPLOAD_FILE)" \
135
+ --data-binary @$UPLOAD_FILE \
136
+ "$UPLOAD_URL?name=$(basename $UPLOAD_FILE)"
120
137
workflows :
121
138
version : 2
122
- build- test-deploy :
139
+ test :
123
140
jobs :
124
141
- google_test
125
- - build
126
- - deploy_library :
127
- requires :
128
- - build
129
- filters :
142
+ build-deploy :
143
+ jobs :
144
+ - build_library :
145
+ filters : &filters
130
146
tags :
131
147
only : /^v[0-9]{1,}(\.[0-9]{1,}){2}$/
132
148
branches :
133
149
ignore : /.*/
150
+ - deploy_library :
151
+ requires :
152
+ - build_library
153
+ filters : *filters
134
154
- build_and_deploy_image :
135
155
requires :
136
- - build
137
- filters :
138
- tags :
139
- only : /^v[0-9]{1,}(\.[0-9]{1,}){2}$/
140
- branches :
141
- ignore : /.*/
156
+ - build_library
157
+ filters : *filters
0 commit comments