Compare commits
No commits in common. "c7c0d7c7d7fc7abacc8d929d23ce6e743e664efa" and "c481b2168c726c40e707c2e8c0b91dfaec90b18d" have entirely different histories.
c7c0d7c7d7
...
c481b2168c
2 changed files with 13 additions and 32 deletions
|
@ -44,7 +44,7 @@ def clone_project_branch() -> None:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def install_actions() -> None:
|
def install_actions(path: Path) -> None:
|
||||||
"""Make actions usable in workflows.
|
"""Make actions usable in workflows.
|
||||||
|
|
||||||
:param path: entry point file
|
:param path: entry point file
|
||||||
|
@ -54,32 +54,20 @@ def install_actions() -> 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"
|
||||||
for action in ["action", "synchronize"]:
|
action = "synchronize"
|
||||||
log.info(action)
|
log.info(action)
|
||||||
directory = root / action
|
directory = root / action
|
||||||
fs.make_directory(directory)
|
fs.make_directory(directory)
|
||||||
match action:
|
fs.write(directory / name, f"""\
|
||||||
case "action":
|
inputs:
|
||||||
inputs = """\
|
|
||||||
arg-1:
|
|
||||||
required: true
|
|
||||||
arg_2:
|
|
||||||
required: true
|
|
||||||
"""
|
|
||||||
case "synchronize":
|
|
||||||
inputs = """\
|
|
||||||
source:
|
source:
|
||||||
default: out
|
default: out
|
||||||
required: false
|
required: false
|
||||||
"""
|
|
||||||
yaml = f"""\
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- run: {vpy} -m spcd {action}
|
- run: {vpy} -m spcd synchronize
|
||||||
inputs:
|
""")
|
||||||
{inputs}"""
|
|
||||||
fs.write(directory / name, yaml)
|
|
||||||
cat(directory / name)
|
cat(directory / name)
|
||||||
|
|
||||||
|
|
||||||
|
|
13
spcd/act.py
13
spcd/act.py
|
@ -4,21 +4,14 @@ import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from rwx import ps
|
from rwx import ps
|
||||||
from rwx.log import stream as log
|
|
||||||
|
|
||||||
from spcd.ci import project, projects
|
from spcd.ci import project, projects
|
||||||
from spcd.shell import env
|
from spcd.shell import env
|
||||||
|
|
||||||
|
|
||||||
def action() -> None:
|
def synchronize(
|
||||||
"""Display action inputs."""
|
source: str | None = None, target: str | None = None
|
||||||
prefix = ""
|
) -> None:
|
||||||
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.
|
"""Synchronize output towards a target.
|
||||||
|
|
||||||
:param source: where to deploy from
|
:param source: where to deploy from
|
||||||
|
|
Loading…
Reference in a new issue