aboutsummaryrefslogtreecommitdiffstats
path: root/hooks/make_release_commit.py
blob: 34caea612eed1261b0b4a8890fa97d7102ec644a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3
import toml
import subprocess
import os
from os import path

def create_release_commit():
    pyproject = toml.load(path.join(os.curdir, 'pyproject.toml'))
    version = pyproject['tool']['poetry']['version']

    p = subprocess.Popen(f'git add . && git commit -m "Release version {version}" && git tag -a "{version}" -m "Release version {version}" && git push && git push --tags',
                         shell=True,
                         cwd=os.curdir)

    p.wait()

if __name__ == '__main__':
    create_release_commit()