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.
: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:

View file

@ -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