Skip to content

Commit bcd4039

Browse files
hovaescohashhar
authored andcommitted
Add release pipeline
1 parent dae4c41 commit bcd4039

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: trino-python-client release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
PYTHON_VERSION: "3.9.5"
8+
9+
jobs:
10+
release:
11+
name: trino-python-client release
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: ${{env.PYTHON_VERSION}}
19+
20+
- name: Configure Git user
21+
run: |
22+
git config user.email "[email protected]"
23+
git config user.name "Trino release automation"
24+
25+
- name: Set release version
26+
run: |
27+
echo "VERSION_NUMBER=$(./setup.py --version)" >> $GITHUB_ENV
28+
echo "NEXT_VERSION_NUMBER=$(echo ${{ env.VERSION_NUMBER }} | awk -F. -v OFS=. '{$2 += 1 ; print}')" >> $GITHUB_ENV
29+
echo Next version number: ${{ env.NEXT_VERSION_NUMBER }}
30+
sed -i 's/${{ env.VERSION_NUMBER }}/${{ env.NEXT_VERSION_NUMBER }}/' trino/__init__.py
31+
32+
- name: Prepare release
33+
run: |
34+
git diff
35+
git commit -am "Bump version to ${{ env.NEXT_VERSION_NUMBER }}"
36+
git tag -m "" "${{ env.NEXT_VERSION_NUMBER }}"
37+
38+
- name: Test release
39+
run: |
40+
python3 -m venv .venv
41+
. .venv/bin/activate
42+
pip install twine wheel setuptools
43+
./setup.py sdist bdist_wheel
44+
pip install dist/trino-${{env.NEXT_VERSION_NUMBER}}.tar.gz
45+
pip install dist/trino-${{env.NEXT_VERSION_NUMBER}}-py3-none-any.whl
46+
twine check dist/trino-${{env.NEXT_VERSION_NUMBER}}-py3-none-any.whl dist/trino-${{env.NEXT_VERSION_NUMBER}}.tar.gz
47+
48+
- name: Release to PyPI
49+
env:
50+
TWINE_USERNAME: __token__
51+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
52+
run: |
53+
twine upload --non-interactive dist/trino-${{env.NEXT_VERSION_NUMBER}}-py3-none-any.whl dist/trino-${{env.NEXT_VERSION_NUMBER}}.tar.gz
54+
55+
- name: Finalize release
56+
run: |
57+
git push origin master "${{ env.NEXT_VERSION_NUMBER }}""

0 commit comments

Comments
 (0)