Skip to content

Commit dd1b056

Browse files
[chore] Automated publication to PyPI, GCR (#65)
This wires up automated publication when release tags are added, to both PyPI and a release of the Docker image to gcr.io.
1 parent f1489f8 commit dd1b056

File tree

4 files changed

+95
-6
lines changed

4 files changed

+95
-6
lines changed

.circleci/.pypirc.enc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Salted__yk�^�7l#p�׾��Pn�.�6c.���;���1 c�1��d��`���ĝ_ \�� �����R
2+
�j�����Q�85t�%���H e

.circleci/config.yml

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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+$/
1448
jobs:
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

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Disclaimer
3434
This is not an official Google product.
3535

3636

37-
.. |release level| image:: https://img.shields.io/badge/release%20level-pre%20alpha-red.svg?style=flat
37+
.. |release level| image:: https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat
3838
:target: https://cloud.google.com/terms/launch-stages
3939
.. |docs| image:: https://readthedocs.org/projects/gapic-generator-python/badge/?version=latest
4040
:target: https://gapic-generator-python.readthedocs.io/

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
setup(
2727
name='gapic-generator',
28-
version='0.0.5',
28+
version='0.1.0',
2929
license='Apache 2.0',
3030
author='Luke Sneeringer',
3131
author_email='lukesneeringer@google.com',
@@ -51,7 +51,7 @@
5151
':python_version<"3.7"': ('dataclasses >= 0.4',),
5252
},
5353
classifiers=(
54-
'Development Status :: 2 - Pre-Alpha',
54+
'Development Status :: 3 - Alpha',
5555
'Environment :: Console',
5656
'Intended Audience :: Developers',
5757
'License :: OSI Approved :: Apache Software License',

0 commit comments

Comments
 (0)