Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:

git fetch origin gh-pages --depth=1

if [[ $GITHUB_EVENT_NAME == "release" && $GITHUB_EVENT_ACTION == "published" ]]; then
if [[ $GITHUB_EVENT_NAME == "release" ]]; then
hatch run docs:gh-release
else
hatch run docs:gh-deploy
Expand All @@ -258,6 +258,8 @@ jobs:
needs:
- Static-Check
- Run-Unit-Tests
- Run-Integration-Tests
- Deploy-Pages
- Code-Coverage
runs-on: ubuntu-latest
steps:
Expand Down
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.21.0"
__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
41 changes: 41 additions & 0 deletions scripts/docs_deploy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import subprocess
import sys

from packaging import version

import dagfactory


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

set_default = False

if deploy_type == "release":
if _version.pre is not None:
command = ["mike", "deploy", "--push", "dev"]
else:
command = ["mike", "deploy", "--push", "--update-aliases", str(_version), "latest"]
set_default = True
else:
command = ["mike", "deploy", "--push", "dev"]

try:
subprocess.run(command, capture_output=True, text=True, check=True)
if set_default:
default_command = ["mike", "set-default", "latest"]
subprocess.run(default_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)