@@ -4,13 +4,47 @@ workflows:
44 version : 2
55 tests :
66 jobs :
7- - unit-3.6
8- - unit-3.7
7+ - unit-3.6 :
8+ filters :
9+ tags :
10+ only : /^\d+\.\d+\.\d+$/
11+ - unit-3.7 :
12+ filters :
13+ tags :
14+ only : /^\d+\.\d+\.\d+$/
915 - showcase :
1016 requires :
1117 - unit-3.6
1218 - unit-3.7
13- - docs
19+ filters :
20+ tags :
21+ only : /^\d+\.\d+\.\d+$/
22+ - docs :
23+ filters :
24+ tags :
25+ only : /^\d+\.\d+\.\d+$/
26+ - publish_package :
27+ requires :
28+ - unit-3.6
29+ - unit-3.7
30+ - showcase
31+ - docs
32+ filters :
33+ branches :
34+ ignore : /.*/
35+ tags :
36+ only : /^\d+\.\d+\.\d+$/
37+ - publish_image :
38+ requires :
39+ - unit-3.6
40+ - unit-3.7
41+ - showcase
42+ - docs
43+ filters :
44+ branches :
45+ ignore : /.*/
46+ tags :
47+ only : /^\d+\.\d+\.\d+$/
1448jobs :
1549 unit-3.6 :
1650 docker :
@@ -103,3 +137,56 @@ jobs:
103137 - run :
104138 name : Build the documentation.
105139 command : nox -s docs
140+ publish_package :
141+ docker :
142+ - image : python:3.7-slim
143+ steps :
144+ - checkout
145+ - run :
146+ name : Decrypt the PyPI key.
147+ command : |
148+ openssl aes-256-cbc -d \
149+ -in .circleci/.pypirc.enc \
150+ -out ~/.pypirc \
151+ -k "${PYPIRC_ENCRYPTION_KEY}"
152+ - run :
153+ name : Publish to PyPI.
154+ command : python setup.py sdist upload
155+ publish_image :
156+ docker :
157+ - image : docker
158+ steps :
159+ - checkout
160+ - setup_remote_docker
161+ - run :
162+ name : Build Docker image.
163+ command : docker build . -t gcr.io/gapic-images/gapic-generator-python:latest
164+ - run :
165+ name : Download curl
166+ command : apk add --no-cache curl
167+ - run :
168+ name : Download the GCR credential helper.
169+ command : |
170+ curl -fsSL https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.5.0/docker-credential-gcr_linux_amd64-1.5.0.tar.gz \
171+ | tar xz --to-stdout ./docker-credential-gcr \
172+ > /usr/bin/docker-credential-gcr && chmod a+x /usr/bin/docker-credential-gcr
173+ - run :
174+ name : Set up authentication to Google Container Registry.
175+ command : |
176+ echo ${GCLOUD_SERVICE_KEY} > ${GOOGLE_APPLICATION_CREDENTIALS}
177+ docker-credential-gcr configure-docker
178+ - run :
179+ name : Tag the Docker image and push it to Google Container Registry.
180+ command : |
181+ if [ -n "$CIRCLE_TAG" ]; then
182+ export MAJOR=`echo $CIRCLE_TAG | awk -F '.' '{ print $1; }'`
183+ export MINOR=`echo $CIRCLE_TAG | awk -F '.' '{ print $2; }'`
184+ export PATCH=`echo $CIRCLE_TAG | awk -F '.' '{ print $3; }'`
185+ docker tag gcr.io/gapic-images/gapic-generator-python:latest gcr.io/gapic-images/gapic-generator-python:$MAJOR.$MINOR.$PATCH
186+ docker tag gcr.io/gapic-images/gapic-generator-python:latest gcr.io/gapic-images/gapic-generator-python:$MAJOR.$MINOR
187+ docker tag gcr.io/gapic-images/gapic-generator-python:latest gcr.io/gapic-images/gapic-generator-python:$MAJOR
188+ docker push gcr.io/gapic-images/gapic-generator-python:$MAJOR.$MINOR.$PATCH
189+ docker push gcr.io/gapic-images/gapic-generator-python:$MAJOR.$MINOR
190+ docker push gcr.io/gapic-images/gapic-generator-python:$MAJOR
191+ fi
192+ docker push gcr.io/gapic-images/gapic-generator-python:latest
0 commit comments