Skip to content

Commit

Permalink
Publish to PyPI via github action (open-telemetry#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
c24t authored Oct 30, 2019
1 parent be56277 commit 6d1cd1f
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Build wheels
run: ./scripts/build.sh
- name: Publish to PyPI
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
pip install twine
twine upload --skip-existing --verbose dist/*
1 change: 1 addition & 0 deletions opentelemetry-api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
description="OpenTelemetry Python API",
include_package_data=True,
long_description=open("README.rst").read(),
long_description_content_type="text/x-rst",
install_requires=["typing; python_version<'3.5'"],
extras_require={},
license="Apache-2.0",
Expand Down
1 change: 1 addition & 0 deletions opentelemetry-sdk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
description="OpenTelemetry Python SDK",
include_package_data=True,
long_description=open("README.rst").read(),
long_description_content_type="text/x-rst",
install_requires=["opentelemetry-api==0.1.dev0"],
extras_require={},
license="Apache-2.0",
Expand Down
24 changes: 24 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

# This script builds wheels for the API, SDK, and extension packages in the
# dist/ dir, to be uploaded to PyPI.

set -ev

# Get the latest versions of packaging tools
python3 -m pip install --upgrade pip setuptools wheel

BASEDIR=$(dirname $(readlink -f $(dirname $0)))

(
cd $BASEDIR
mkdir -p dist
rm -rf dist/*

for d in opentelemetry-api/ opentelemetry-sdk/ ext/*/ ; do
(
cd "$d"
python3 setup.py --verbose bdist_wheel --dist-dir "$BASEDIR/dist/"
)
done
)

0 comments on commit 6d1cd1f

Please sign in to comment.