This commit is contained in:
Marc Beninca 2024-10-20 18:52:16 +02:00
parent 924e44a9d9
commit 886fcf3673
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -44,7 +44,7 @@ def clone_project_branch() -> None:
) )
def install_actions(path: Path) -> None: def install_actions() -> None:
"""Make actions usable in workflows. """Make actions usable in workflows.
:param path: entry point file :param path: entry point file
@ -54,20 +54,33 @@ def install_actions(path: Path) -> None:
name = "action.yaml" name = "action.yaml"
root = project.root / "act" root = project.root / "act"
vpy = Path(env.SPCD_PYTHON_VENV_BINARIES) / "python" vpy = Path(env.SPCD_PYTHON_VENV_BINARIES) / "python"
action = "synchronize" for action in ["action", "synchronize"]:
log.info(action) log.info(action)
directory = root / action directory = root / action
fs.make_directory(directory) fs.make_directory(directory)
fs.write(directory / name, f"""\ match action:
case "action":
yaml = """\
inputs:
arg-1:
required: true
arg_2:
required: true
"""
case "synchronize":
yaml = """\
inputs: inputs:
source: source:
default: out default: out
required: false required: false
"""
yaml = f"""{yaml}\
runs: runs:
using: composite using: composite
steps: steps:
- run: {vpy} -m spcd synchronize - run: {vpy} -m spcd {action}
""") """
fs.write(directory / name, yaml)
cat(directory / name) cat(directory / name)