ci: create a nightly build workflow (#3553)

* test poetry install

* Add nightly builds workflow

* remove old comments and fix poetry

* remove old debug statement

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Jordan Frazier 2024-09-05 12:13:04 -07:00 • committed by GitHub
commit 7b3e51f769
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 1770 additions and 1055 deletions

View file

@ -31,9 +31,22 @@ def get_version_from_pypi(package_name):
return None
def update_pyproject_dependency(pyproject_path, version):
def is_development_release(version):
"""
Determines if the version is a development version based on PEP 440.
We consider a development version (.devN) as our nightly versions
"""
return "dev" in version
def update_pyproject_dependency(pyproject_path, version, is_nightly):
pattern = re.compile(r'langflow-base = \{ path = "\./src/backend/base", develop = true \}')
replacement = f'langflow-base = "^{version}"'
if is_nightly:
# NOTE: This process can be simplified; see the note in update_lf_base_dependency.py
replacement = f'langflow-base-nightly = "{version}"'
else:
replacement = f'langflow-base = "^{version}"'
with open(pyproject_path, "r") as file:
content = file.read()
content = pattern.sub(replacement, content)
@ -57,6 +70,9 @@ if __name__ == "__main__":
langflow_base_path = Path(__file__).resolve().parent / "../src/backend/base/pyproject.toml"
version = read_version_from_pyproject(langflow_base_path)
if version:
update_pyproject_dependency(pyproject_path, version)
# Nightly versions contain "dev"
# WARNING: This will cause issues if we release `.dev` versions to `langflow` or `langflow-base`
is_nightly = is_development_release(version)
update_pyproject_dependency(pyproject_path, version, is_nightly)
else:
print("Error: Version not found.")