Added publish yml. This still needs the twine secrets

This commit is contained in:
jerevoss 2022-08-29 15:06:27 -07:00
Родитель 85c1476e63
Коммит 81784f023e
2 изменённых файлов: 71 добавлений и 0 удалений

37
.github/workflows/publish.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,37 @@
name: Publish
on:
release:
types: [published]
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: Install twine
run: |
pip install twine
# The step below publishes to testpypi in order to catch any issues
# with the package configuration that would cause a failure to upload
# to pypi. One example of such a failure is if a classifier is
# rejected by pypi (e.g "3 - Beta"). This would cause a failure during the
# middle of the package upload causing the action to fail, and certain packages
# might have already been updated, this would be bad.
- name: Publish to TestPyPI
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
run: |
twine upload --repository testpypi --skip-existing --verbose dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
twine upload --skip-existing --verbose dist/*

34
scripts/build.sh Normal file
Просмотреть файл

@ -0,0 +1,34 @@
#!/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
python -m pip install --upgrade pip build setuptools wheel
BASEDIR=$(dirname $(readlink -f $(dirname $0)))
DISTDIR=dist
(
cd $BASEDIR
mkdir -p $DISTDIR
rm -rf $DISTDIR/*
for d in azure-monitor-opentelemetry-distro; do
(
echo "building $d"
cd "$d"
# Package distribution in dist folder
python setup.py sdist --dist-dir "$BASEDIR/dist/" clean --all
)
done
# Build a wheel for each source distribution
(
cd $DISTDIR
for x in *.tar.gz ; do
pip wheel --no-deps $x
done
)
)