mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-08-03 04:10:48 +08:00
copying scripts to prepare release (#211)
This commit is contained in:
37
.github/workflows/publish.yml
vendored
Normal file
37
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
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: 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/*
|
37
scripts/build.sh
Executable file
37
scripts/build.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/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)))
|
||||
DISTDIR=dist
|
||||
|
||||
(
|
||||
cd $BASEDIR
|
||||
mkdir -p $DISTDIR
|
||||
rm -rf $DISTDIR/*
|
||||
|
||||
for d in exporter/*/ instrumentation/*/ sdk-extension/*/ ; do
|
||||
(
|
||||
echo "building $d"
|
||||
cd "$d"
|
||||
# Some ext directories (such as docker tests) are not intended to be
|
||||
# packaged. Verify the intent by looking for a setup.py.
|
||||
if [ -f setup.py ]; then
|
||||
python3 setup.py sdist --dist-dir "$BASEDIR/dist/" clean --all
|
||||
fi
|
||||
)
|
||||
done
|
||||
# Build a wheel for each source distribution
|
||||
(
|
||||
cd $DISTDIR
|
||||
for x in *.tar.gz ; do
|
||||
pip wheel --no-deps $x
|
||||
done
|
||||
)
|
||||
)
|
42
scripts/prepare_release.sh
Executable file
42
scripts/prepare_release.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/zsh
|
||||
#
|
||||
# This script:
|
||||
# 1. parses the version number from the branch name
|
||||
# 2. updates version.py files to match that version
|
||||
# 3. iterates through CHANGELOG.md files and updates any files containing
|
||||
# unreleased changes
|
||||
# 4. sets the output variable 'version_updated' to determine whether
|
||||
# the github action to create a pull request should run. this allows
|
||||
# maintainers to merge changes back into the release branch without
|
||||
# triggering unnecessary pull requests
|
||||
#
|
||||
|
||||
VERSION=`echo $1 | awk -F "/" '{print $NF}'`
|
||||
echo "Using version ${VERSION}"
|
||||
|
||||
# check the version matches expected versioning e.g
|
||||
# 0.6, 0.6b, 0.6b0, 0.6.0
|
||||
if [[ ! "${VERSION}" =~ ^([0-9])(\.*[0-9]{1,5}[a-b]*){1,3}$ ]]; then
|
||||
echo "Version number invalid: $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# create the release branch
|
||||
git checkout -b release/${VERSION}
|
||||
git push origin release/${VERSION}
|
||||
|
||||
# create a temporary branch to create a PR for updated version and changelogs
|
||||
git checkout -b release/${VERSION}-auto
|
||||
./scripts/eachdist.py release --version ${VERSION}
|
||||
rc=$?
|
||||
if [ $rc != 0 ]; then
|
||||
echo "::set-output name=version_updated::0"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git add **/version.py **/setup.cfg **/CHANGELOG.md
|
||||
|
||||
git commit -m "updating changelogs and version to ${VERSION}"
|
||||
|
||||
echo "Time to create a release, here's a sample title:"
|
||||
echo "[pre-release] Update changelogs, version [${VERSION}]"
|
Reference in New Issue
Block a user