Compare commits
4 commits
c481b2168c
...
c7c0d7c7d7
Author | SHA1 | Date | |
---|---|---|---|
c7c0d7c7d7 | |||
c77674afa4 | |||
886fcf3673 | |||
924e44a9d9 |
2 changed files with 32 additions and 13 deletions
|
@ -44,7 +44,7 @@ def clone_project_branch() -> None:
|
|||
)
|
||||
|
||||
|
||||
def install_actions(path: Path) -> None:
|
||||
def install_actions() -> None:
|
||||
"""Make actions usable in workflows.
|
||||
|
||||
:param path: entry point file
|
||||
|
@ -54,21 +54,33 @@ def install_actions(path: Path) -> None:
|
|||
name = "action.yaml"
|
||||
root = project.root / "act"
|
||||
vpy = Path(env.SPCD_PYTHON_VENV_BINARIES) / "python"
|
||||
action = "synchronize"
|
||||
log.info(action)
|
||||
directory = root / action
|
||||
fs.make_directory(directory)
|
||||
fs.write(directory / name, f"""\
|
||||
inputs:
|
||||
for action in ["action", "synchronize"]:
|
||||
log.info(action)
|
||||
directory = root / action
|
||||
fs.make_directory(directory)
|
||||
match action:
|
||||
case "action":
|
||||
inputs = """\
|
||||
arg-1:
|
||||
required: true
|
||||
arg_2:
|
||||
required: true
|
||||
"""
|
||||
case "synchronize":
|
||||
inputs = """\
|
||||
source:
|
||||
default: out
|
||||
required: false
|
||||
"""
|
||||
yaml = f"""\
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- run: {vpy} -m spcd synchronize
|
||||
""")
|
||||
cat(directory / name)
|
||||
- run: {vpy} -m spcd {action}
|
||||
inputs:
|
||||
{inputs}"""
|
||||
fs.write(directory / name, yaml)
|
||||
cat(directory / name)
|
||||
|
||||
|
||||
def install_commands(path: Path) -> None:
|
||||
|
|
13
spcd/act.py
13
spcd/act.py
|
@ -4,14 +4,21 @@ import os
|
|||
from pathlib import Path
|
||||
|
||||
from rwx import ps
|
||||
from rwx.log import stream as log
|
||||
|
||||
from spcd.ci import project, projects
|
||||
from spcd.shell import env
|
||||
|
||||
|
||||
def synchronize(
|
||||
source: str | None = None, target: str | None = None
|
||||
) -> None:
|
||||
def action() -> None:
|
||||
"""Display action inputs."""
|
||||
prefix = ""
|
||||
for variable, value in sorted(projects.environment.items()):
|
||||
if variable.startswith(prefix):
|
||||
log.info("%s = %s", variable, value)
|
||||
|
||||
|
||||
def synchronize(source: str | None = None, target: str | None = None) -> None:
|
||||
"""Synchronize output towards a target.
|
||||
|
||||
:param source: where to deploy from
|
||||
|
|
Loading…
Reference in a new issue