Skip to content

Commit

Permalink
Release 0.22.0a2
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed Jan 9, 2025
1 parent b62e3a6 commit 4e3fcaa
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dagfactory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .dagfactory import DagFactory, load_yaml_dags

__version__ = "0.22.0a1"
__version__ = "0.22.0a2"
__all__ = [
"DagFactory",
"load_yaml_dags",
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ dependencies = [

[tool.hatch.envs.docs.scripts]
dev = "mkdocs build && mkdocs serve" # For local development and preventing publishing
gh-deploy = "mike deploy --push dev"
gh-release = "version=$(python -W ignore -c 'import dagfactory; print(dagfactory.__version__)') && mike deploy --push --update-aliases $version latest"
gh-deploy = "python scripts/docs_deploy.py dev"
gh-release = "python scripts/docs_deploy.py release"

######################################
# THIRD PARTY TOOLS
Expand Down
48 changes: 48 additions & 0 deletions scripts/docs_deploy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import subprocess
import sys

from packaging import version

import dagfactory


def deploy_docs(deploy_type: str):
_version = version.parse(dagfactory.__version__)

if deploy_type == "release":
if _version.pre is not None:
command = ["mike", "deploy", "--push", "dev"]
# TODO: Remove L13-L18
default_command = ["mike", "set-default", str(_version)]
try:
subprocess.run(default_command, capture_output=True, text=True, check=True)
except subprocess.CalledProcessError as e:
raise Exception(f"Error setting mike default: {e.stderr}")
else:
command = ["mike", "deploy", "--push", "--update-aliases", str(_version), "latest"]
default_command = ["mike", "set-default", str(_version)]

try:
subprocess.run(default_command, capture_output=True, text=True, check=True)
except subprocess.CalledProcessError as e:
raise Exception(f"Error setting mike default: {e.stderr}")

else:
command = ["mike", "deploy", "--push", "dev"]

try:
subprocess.run(command, capture_output=True, text=True, check=True)
except subprocess.CalledProcessError as e:
raise Exception(f"Error deploying: {e.stderr}")


if __name__ == "__main__":
if len(sys.argv) < 2:
raise Exception("Argument deploy type is required: 'dev' or 'release'")

deploy_type = sys.argv[1]

if deploy_type not in ["dev", "release"]:
raise Exception("Invalid argument provided. Valid deploy types are 'dev' or 'release'.")

deploy_docs(deploy_type)

0 comments on commit 4e3fcaa

Please sign in to comment.