Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit fea059e

Browse files
authored
Automate release process using CircleCI (#320)
1 parent 972c3d2 commit fea059e

3 files changed

Lines changed: 43 additions & 12 deletions

File tree

.circleci/config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,12 @@ jobs:
3838
name: Run tests - opencensus
3939
command: |
4040
nox -f nox.py
41+
- deploy:
42+
name: Push to PyPI (if this is a release tag).
43+
command: scripts/twine_upload.sh
44+
45+
deployment:
46+
tag_build_for_cci2:
47+
tag: /(([a-z]+)-)*([0-9]+)\.([0-9]+)\.([0-9]+)/
48+
commands:
49+
- true

RELEASING.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,10 @@
22

33
## Steps
44

5-
### Create a Github release
6-
75
### Update the version number in `setup.py`
86

97
### Update the version number in `stackdriver_exporter.py`
108

11-
### Build the Python wheel
12-
13-
```
14-
python setup.py bdist_wheel
15-
```
16-
17-
### Upload the package to PyPI using twine
9+
### Create a Github release
1810

19-
```
20-
twine upload dist/*
21-
```
11+
Then the Circle CI will build the package and upload it to PyPI automatically.

scripts/twine_upload.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2018, OpenCensus Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
set -ev
16+
17+
# If this is not a CircleCI tag, no-op.
18+
if [[ -z "$CIRCLE_TAG" ]]; then
19+
echo "This is not a release tag. Doing nothing."
20+
exit 0
21+
fi
22+
23+
echo -e "[pypi]" >> ~/.pypirc
24+
echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
25+
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
26+
27+
# Ensure that we have the latest versions of Twine, Wheel, and Setuptools.
28+
python3 -m pip install --upgrade twine wheel setuptools
29+
30+
# Build the distribution and upload.
31+
python3 setup.py bdist_wheel
32+
twine upload dist/*

0 commit comments

Comments
 (0)