ci: add dev deploy job
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c8c7961e1c
commit
1ee3b01f9a
6 changed files with 131 additions and 2 deletions
0
ci/__init__.py
Normal file
0
ci/__init__.py
Normal file
49
ci/bump_dev.py
Normal file
49
ci/bump_dev.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
from pip_versions import core
|
||||
from sh import poetry # pylint: disable=no-name-in-module
|
||||
from decouple import config
|
||||
|
||||
username = config("REGISTRY_USERNAME")
|
||||
password = config("REGISTRY_PASSWORD")
|
||||
package_name = config("PACKAGE_NAME", "ports")
|
||||
if not (index_url := os.getenv("EXTRA_INDEX_URL")):
|
||||
os.environ[
|
||||
"EXTRA_INDEX_URL"
|
||||
] = "https://git.roboces.dev/api/packages/catalin/pypi/simple"
|
||||
|
||||
|
||||
def main(): # pylint: disable=missing-function-docstring
|
||||
current_version = poetry("version", _tty_out=False).split()[-1]
|
||||
if "dev" in current_version:
|
||||
print("Already on dev version")
|
||||
sys.exit(1)
|
||||
|
||||
dev_versions_of_current_version = sorted(
|
||||
x.version.dev
|
||||
for x in core.find_versions(package_name=package_name)
|
||||
if x.version.base_version == current_version and x
|
||||
)
|
||||
# dev_versions_of_current_version = sorted(
|
||||
# filter(
|
||||
# lambda x: x,
|
||||
# map(
|
||||
# lambda x: x.version.dev,
|
||||
# filter(
|
||||
# lambda x: x.version.base_version == current_version,
|
||||
# core.find_versions(package_name=package_name),
|
||||
# ),
|
||||
# ),
|
||||
# )
|
||||
# )
|
||||
if not dev_versions_of_current_version:
|
||||
dev_versions_of_current_version = [0]
|
||||
last_dev_version = max(dev_versions_of_current_version)
|
||||
new_version = f"{current_version}.dev{last_dev_version + 1}"
|
||||
poetry("version", new_version)
|
||||
print(f"Bumped version to {new_version}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue