Skip to content

Commit

Permalink
[chore] Automated publication to PyPI, GCR (#65)
Browse files Browse the repository at this point in the history
This wires up automated publication when release tags are added,
to both PyPI and a release of the Docker image to gcr.io.
  • Loading branch information
lukesneeringer authored Dec 7, 2018
1 parent f1489f8 commit dd1b056
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .circleci/.pypirc.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Salted__yk�^�7l#p�׾��Pn�.�6c.���;���1 c�1��d��`���ĝ_ \�� �����R
�j�����Q�85t�%���H e
93 changes: 90 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,47 @@ workflows:
version: 2
tests:
jobs:
- unit-3.6
- unit-3.7
- unit-3.6:
filters:
tags:
only: /^\d+\.\d+\.\d+$/
- unit-3.7:
filters:
tags:
only: /^\d+\.\d+\.\d+$/
- showcase:
requires:
- unit-3.6
- unit-3.7
- docs
filters:
tags:
only: /^\d+\.\d+\.\d+$/
- docs:
filters:
tags:
only: /^\d+\.\d+\.\d+$/
- publish_package:
requires:
- unit-3.6
- unit-3.7
- showcase
- docs
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/
- publish_image:
requires:
- unit-3.6
- unit-3.7
- showcase
- docs
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/
jobs:
unit-3.6:
docker:
Expand Down Expand Up @@ -103,3 +137,56 @@ jobs:
- run:
name: Build the documentation.
command: nox -s docs
publish_package:
docker:
- image: python:3.7-slim
steps:
- checkout
- run:
name: Decrypt the PyPI key.
command: |
openssl aes-256-cbc -d \
-in .circleci/.pypirc.enc \
-out ~/.pypirc \
-k "${PYPIRC_ENCRYPTION_KEY}"
- run:
name: Publish to PyPI.
command: python setup.py sdist upload
publish_image:
docker:
- image: docker
steps:
- checkout
- setup_remote_docker
- run:
name: Build Docker image.
command: docker build . -t gcr.io/gapic-images/gapic-generator-python:latest
- run:
name: Download curl
command: apk add --no-cache curl
- run:
name: Download the GCR credential helper.
command: |
curl -fsSL https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.5.0/docker-credential-gcr_linux_amd64-1.5.0.tar.gz \
| tar xz --to-stdout ./docker-credential-gcr \
> /usr/bin/docker-credential-gcr && chmod a+x /usr/bin/docker-credential-gcr
- run:
name: Set up authentication to Google Container Registry.
command: |
echo ${GCLOUD_SERVICE_KEY} > ${GOOGLE_APPLICATION_CREDENTIALS}
docker-credential-gcr configure-docker
- run:
name: Tag the Docker image and push it to Google Container Registry.
command: |
if [ -n "$CIRCLE_TAG" ]; then
export MAJOR=`echo $CIRCLE_TAG | awk -F '.' '{ print $1; }'`
export MINOR=`echo $CIRCLE_TAG | awk -F '.' '{ print $2; }'`
export PATCH=`echo $CIRCLE_TAG | awk -F '.' '{ print $3; }'`
docker tag gcr.io/gapic-images/gapic-generator-python:latest gcr.io/gapic-images/gapic-generator-python:$MAJOR.$MINOR.$PATCH
docker tag gcr.io/gapic-images/gapic-generator-python:latest gcr.io/gapic-images/gapic-generator-python:$MAJOR.$MINOR
docker tag gcr.io/gapic-images/gapic-generator-python:latest gcr.io/gapic-images/gapic-generator-python:$MAJOR
docker push gcr.io/gapic-images/gapic-generator-python:$MAJOR.$MINOR.$PATCH
docker push gcr.io/gapic-images/gapic-generator-python:$MAJOR.$MINOR
docker push gcr.io/gapic-images/gapic-generator-python:$MAJOR
fi
docker push gcr.io/gapic-images/gapic-generator-python:latest
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Disclaimer
This is not an official Google product.


.. |release level| image:: https://img.shields.io/badge/release%20level-pre%20alpha-red.svg?style=flat
.. |release level| image:: https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat
:target: https://cloud.google.com/terms/launch-stages
.. |docs| image:: https://readthedocs.org/projects/gapic-generator-python/badge/?version=latest
:target: https://gapic-generator-python.readthedocs.io/
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

setup(
name='gapic-generator',
version='0.0.5',
version='0.1.0',
license='Apache 2.0',
author='Luke Sneeringer',
author_email='lukesneeringer@google.com',
Expand All @@ -51,7 +51,7 @@
':python_version<"3.7"': ('dataclasses >= 0.4',),
},
classifiers=(
'Development Status :: 2 - Pre-Alpha',
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
Expand Down

0 comments on commit dd1b056

Please sign in to comment.