-
Notifications
You must be signed in to change notification settings - Fork 170
65 lines (54 loc) · 2.21 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 }}"