Skip to content

trino-python-client release #14

trino-python-client release

trino-python-client release #14

Workflow file for this run

name: trino-python-client release
on:
workflow_dispatch:
env:
PYTHON_VERSION: "3.12"
jobs:
release:
name: trino-python-client release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install setuptools
run: pip install setuptools
- name: Configure Git user
run: |
git config user.email "[email protected]"
git config user.name "Trino release automation"
- name: Set release version
run: |
VERSION_NUMBER="$(./setup.py --version)"
NEXT_VERSION_NUMBER="$(echo ${VERSION_NUMBER} | awk -F. -v OFS=. '{$2 += 1 ; print}')"
echo "Current version: ${VERSION_NUMBER}; Next version number: ${NEXT_VERSION_NUMBER}"
sed -i "s/${VERSION_NUMBER}/${NEXT_VERSION_NUMBER}/g" trino/_version.py
# Export for use in next steps
echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_ENV
echo "NEXT_VERSION_NUMBER=${NEXT_VERSION_NUMBER}" >> $GITHUB_ENV
- name: Prepare release
run: |
git diff
git commit -am "Bump version to ${{ env.NEXT_VERSION_NUMBER }}"
git tag -m "" "${{ env.NEXT_VERSION_NUMBER }}"
- name: Test release
run: |
python3 -m venv .venv
. .venv/bin/activate
pip install twine wheel setuptools
./setup.py sdist bdist_wheel
pip install dist/trino-${{env.NEXT_VERSION_NUMBER}}.tar.gz
pip install dist/trino-${{env.NEXT_VERSION_NUMBER}}-py3-none-any.whl
twine check dist/trino-${{env.NEXT_VERSION_NUMBER}}-py3-none-any.whl dist/trino-${{env.NEXT_VERSION_NUMBER}}.tar.gz
- name: Release to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
# twin is installed in the venv in "Test release"
. .venv/bin/activate
twine upload --non-interactive dist/trino-${{env.NEXT_VERSION_NUMBER}}-py3-none-any.whl dist/trino-${{env.NEXT_VERSION_NUMBER}}.tar.gz
- name: Finalize release
run: |
git push origin master "${{ env.NEXT_VERSION_NUMBER }}"