diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-git-conventional-version.spec | 394 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 396 insertions, 0 deletions
@@ -0,0 +1 @@ +/git-conventional-version-1.0.2.tar.gz diff --git a/python-git-conventional-version.spec b/python-git-conventional-version.spec new file mode 100644 index 0000000..60de474 --- /dev/null +++ b/python-git-conventional-version.spec @@ -0,0 +1,394 @@ +%global _empty_manifest_terminate_build 0 +Name: python-git-conventional-version +Version: 1.0.2 +Release: 1 +Summary: Automatic conventional version +License: MIT License +URL: https://github.com/atudomain/git-conventional-version +Source0: https://mirrors.aliyun.com/pypi/web/packages/e9/3a/e8386256d529b4c5c64d6533b4460c8739b8a1d9945a628d80deeb11bc04/git-conventional-version-1.0.2.tar.gz +BuildArch: noarch + +Requires: python3-GitPython + +%description +# GIT-CONVENTIONAL-VERSION + + + +Find version automatically based on git tags and commit messages. + +The tool is very specific in its function, so it is very flexible. + +You can use it as a part of many different integrations and it will not break your process. + +## Install + +``` +python3 -m pip install git-conventional-version +``` + +## Usage + +Get new bumped final version: +``` +gcv +``` + +Get new bumped release candidate version: +``` +gcv --type=rc +``` + +Get current (old) version, 0.0.0 if none exists: +``` +gcv --old +``` + +Example of CI automation script: +``` +old=$(gcv --old) +new=$(gcv) +# check if version bump would happen +if [ ! $new == $old ]; then + # if yes, update setup.cfg + sed -i "s/^version.*/version = $new/g" setup.cfg + # and commit release + git add setup.cfg + git commit -m "$new" + git tag "$new" + git push --tags + git push +fi +``` + +## Version formats + +Tags are equivalent to versions, no suffix or prefix is added or interpreted. +Formats follow https://www.python.org/dev/peps/pep-0440/. + +- Final version + +Standard tag is in the format `\d+\.\d+\.d+` ie. `1.0.0`. It can be divided into `major` . `minor` . `patch` versions. + +It is automatically bumped based on commits messages and old version of the same type (look at `Git commit message convention` below). + +- Pre-release versions + +Pre-release versions bumps are calculated based on last final version, its expected bump and old version of the same pre-release type. + +- - Release candidate version + +Format `\d+\.\d+\.d+rc\d+` ie. `1.0.0rc1`. + +- - Developmental version + +Format `\d+\.\d+\.d+dev\d+` ie. `1.0.0dev1`. + +- - Alpha version + +Format `\d+\.\d+\.d+a\d+` ie. `1.0.0a1`. + +- - Beta version + +Format `\d+\.\d+\.d+b\d+` ie. `1.0.0b1`. + +- Local version + +Also, local version can be created from commit sha and old version: `\d+\.\d+\.d\+.+` ie. `0.0.0+79ad`. + +## Git commit message convention + +Convention is based on https://www.conventionalcommits.org/en/v1.0.0/ (it's good!). +At the moment, only the following rules apply (I usually use only these but more can be added easily): +- Start commit with 'fix:' or 'fix(.*):' to bump patch version. +- Start commit with 'feat:' or 'feat(.*):' to bump minor version. +- Include in the commit line with 'breaking change:' to bump major version. + +## Automatic changelog + +On branch where your version tags are present, you can generate changelog: +``` +gcv-log +``` +Full changelog is generated and printed to stdout. You can redirect it to a file. +Assumes that you are about to release next version if not on commit with final version. + +## Notices + +Automatically handling many types of version tags in git is more complicated than it initially seems like. + + + + +%package -n python3-git-conventional-version +Summary: Automatic conventional version +Provides: python-git-conventional-version +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-git-conventional-version +# GIT-CONVENTIONAL-VERSION + + + +Find version automatically based on git tags and commit messages. + +The tool is very specific in its function, so it is very flexible. + +You can use it as a part of many different integrations and it will not break your process. + +## Install + +``` +python3 -m pip install git-conventional-version +``` + +## Usage + +Get new bumped final version: +``` +gcv +``` + +Get new bumped release candidate version: +``` +gcv --type=rc +``` + +Get current (old) version, 0.0.0 if none exists: +``` +gcv --old +``` + +Example of CI automation script: +``` +old=$(gcv --old) +new=$(gcv) +# check if version bump would happen +if [ ! $new == $old ]; then + # if yes, update setup.cfg + sed -i "s/^version.*/version = $new/g" setup.cfg + # and commit release + git add setup.cfg + git commit -m "$new" + git tag "$new" + git push --tags + git push +fi +``` + +## Version formats + +Tags are equivalent to versions, no suffix or prefix is added or interpreted. +Formats follow https://www.python.org/dev/peps/pep-0440/. + +- Final version + +Standard tag is in the format `\d+\.\d+\.d+` ie. `1.0.0`. It can be divided into `major` . `minor` . `patch` versions. + +It is automatically bumped based on commits messages and old version of the same type (look at `Git commit message convention` below). + +- Pre-release versions + +Pre-release versions bumps are calculated based on last final version, its expected bump and old version of the same pre-release type. + +- - Release candidate version + +Format `\d+\.\d+\.d+rc\d+` ie. `1.0.0rc1`. + +- - Developmental version + +Format `\d+\.\d+\.d+dev\d+` ie. `1.0.0dev1`. + +- - Alpha version + +Format `\d+\.\d+\.d+a\d+` ie. `1.0.0a1`. + +- - Beta version + +Format `\d+\.\d+\.d+b\d+` ie. `1.0.0b1`. + +- Local version + +Also, local version can be created from commit sha and old version: `\d+\.\d+\.d\+.+` ie. `0.0.0+79ad`. + +## Git commit message convention + +Convention is based on https://www.conventionalcommits.org/en/v1.0.0/ (it's good!). +At the moment, only the following rules apply (I usually use only these but more can be added easily): +- Start commit with 'fix:' or 'fix(.*):' to bump patch version. +- Start commit with 'feat:' or 'feat(.*):' to bump minor version. +- Include in the commit line with 'breaking change:' to bump major version. + +## Automatic changelog + +On branch where your version tags are present, you can generate changelog: +``` +gcv-log +``` +Full changelog is generated and printed to stdout. You can redirect it to a file. +Assumes that you are about to release next version if not on commit with final version. + +## Notices + +Automatically handling many types of version tags in git is more complicated than it initially seems like. + + + + +%package help +Summary: Development documents and examples for git-conventional-version +Provides: python3-git-conventional-version-doc +%description help +# GIT-CONVENTIONAL-VERSION + + + +Find version automatically based on git tags and commit messages. + +The tool is very specific in its function, so it is very flexible. + +You can use it as a part of many different integrations and it will not break your process. + +## Install + +``` +python3 -m pip install git-conventional-version +``` + +## Usage + +Get new bumped final version: +``` +gcv +``` + +Get new bumped release candidate version: +``` +gcv --type=rc +``` + +Get current (old) version, 0.0.0 if none exists: +``` +gcv --old +``` + +Example of CI automation script: +``` +old=$(gcv --old) +new=$(gcv) +# check if version bump would happen +if [ ! $new == $old ]; then + # if yes, update setup.cfg + sed -i "s/^version.*/version = $new/g" setup.cfg + # and commit release + git add setup.cfg + git commit -m "$new" + git tag "$new" + git push --tags + git push +fi +``` + +## Version formats + +Tags are equivalent to versions, no suffix or prefix is added or interpreted. +Formats follow https://www.python.org/dev/peps/pep-0440/. + +- Final version + +Standard tag is in the format `\d+\.\d+\.d+` ie. `1.0.0`. It can be divided into `major` . `minor` . `patch` versions. + +It is automatically bumped based on commits messages and old version of the same type (look at `Git commit message convention` below). + +- Pre-release versions + +Pre-release versions bumps are calculated based on last final version, its expected bump and old version of the same pre-release type. + +- - Release candidate version + +Format `\d+\.\d+\.d+rc\d+` ie. `1.0.0rc1`. + +- - Developmental version + +Format `\d+\.\d+\.d+dev\d+` ie. `1.0.0dev1`. + +- - Alpha version + +Format `\d+\.\d+\.d+a\d+` ie. `1.0.0a1`. + +- - Beta version + +Format `\d+\.\d+\.d+b\d+` ie. `1.0.0b1`. + +- Local version + +Also, local version can be created from commit sha and old version: `\d+\.\d+\.d\+.+` ie. `0.0.0+79ad`. + +## Git commit message convention + +Convention is based on https://www.conventionalcommits.org/en/v1.0.0/ (it's good!). +At the moment, only the following rules apply (I usually use only these but more can be added easily): +- Start commit with 'fix:' or 'fix(.*):' to bump patch version. +- Start commit with 'feat:' or 'feat(.*):' to bump minor version. +- Include in the commit line with 'breaking change:' to bump major version. + +## Automatic changelog + +On branch where your version tags are present, you can generate changelog: +``` +gcv-log +``` +Full changelog is generated and printed to stdout. You can redirect it to a file. +Assumes that you are about to release next version if not on commit with final version. + +## Notices + +Automatically handling many types of version tags in git is more complicated than it initially seems like. + + + + +%prep +%autosetup -n git-conventional-version-1.0.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-git-conventional-version -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.2-1 +- Package Spec generated @@ -0,0 +1 @@ +9c16d58ea64ce8648e86bc67ab709648 git-conventional-version-1.0.2.tar.gz |