Compare commits

..

4 commits

Author SHA1 Message Date
c7c0d7c7d7
action
Some checks failed
/ alpine (push) Failing after 26s
/ debian (push) Failing after 1m4s
/ ubuntu (push) Failing after 1m27s
/ arch (push) Failing after 1m25s
/ opensuse (push) Failing after 2m16s
/ fedora (push) Failing after 8m20s
/ alma (push) Failing after 1m41s
/ rocky (push) Failing after 10m41s
2024-10-20 19:12:47 +02:00
c77674afa4
inputs 2024-10-20 18:54:47 +02:00
886fcf3673
action 2024-10-20 18:52:16 +02:00
924e44a9d9
lint 2024-10-20 18:50:50 +02:00
2 changed files with 32 additions and 13 deletions

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,32 @@ 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:
inputs: case "action":
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 synchronize - run: {vpy} -m spcd {action}
""") inputs:
{inputs}"""
fs.write(directory / name, yaml)
cat(directory / name) cat(directory / name)

View file

@ -4,14 +4,21 @@ 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 synchronize( def action() -> None:
source: str | None = None, target: str | None = None """Display action inputs."""
) -> None: 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. """Synchronize output towards a target.
:param source: where to deploy from :param source: where to deploy from