actions/synchronize
Some checks failed
/ alpine (push) Successful in 45s
/ debian (push) Failing after 1m3s
/ ubuntu (push) Failing after 1m4s
/ arch (push) Successful in 1m42s
/ opensuse (push) Successful in 2m27s
/ fedora (push) Successful in 9m32s
/ alma (push) Failing after 1m40s
/ rocky (push) Failing after 2m28s
Some checks failed
/ alpine (push) Successful in 45s
/ debian (push) Failing after 1m3s
/ ubuntu (push) Failing after 1m4s
/ arch (push) Successful in 1m42s
/ opensuse (push) Successful in 2m27s
/ fedora (push) Successful in 9m32s
/ alma (push) Failing after 1m40s
/ rocky (push) Failing after 2m28s
This commit is contained in:
parent
f9c8cbc59e
commit
588bf5c6c4
3 changed files with 51 additions and 8 deletions
|
@ -10,7 +10,7 @@ from rwx import fs
|
||||||
from rwx.log import stream as log
|
from rwx.log import stream as log
|
||||||
from rwx.ps import run
|
from rwx.ps import run
|
||||||
|
|
||||||
from spcd import cmd
|
from spcd import act, cmd
|
||||||
from spcd.ci import project, projects
|
from spcd.ci import project, projects
|
||||||
from spcd.shell import env
|
from spcd.shell import env
|
||||||
from spcd.util import browse, cat, split, step
|
from spcd.util import browse, cat, split, step
|
||||||
|
@ -131,6 +131,11 @@ def main(main_file: Path) -> None:
|
||||||
path, *arguments = sys.argv
|
path, *arguments = sys.argv
|
||||||
name = Path(path).name
|
name = Path(path).name
|
||||||
if name == "__main__.py":
|
if name == "__main__.py":
|
||||||
|
if arguments:
|
||||||
|
name, *arguments = arguments
|
||||||
|
f = getattr(act, name)
|
||||||
|
f(*arguments)
|
||||||
|
else:
|
||||||
list_environment_variables()
|
list_environment_variables()
|
||||||
clone_project_branch()
|
clone_project_branch()
|
||||||
set_ssh()
|
set_ssh()
|
||||||
|
|
38
spcd/act.py
Normal file
38
spcd/act.py
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
"""Actions available for workflows."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from rwx import ps
|
||||||
|
|
||||||
|
from spcd.ci import project, projects
|
||||||
|
from spcd.shell import env
|
||||||
|
|
||||||
|
|
||||||
|
def synchronize(
|
||||||
|
source: str | None = None, target: str | None = None
|
||||||
|
) -> None:
|
||||||
|
"""Synchronize output towards a target.
|
||||||
|
|
||||||
|
:param source: where to deploy from
|
||||||
|
:type source: str | None
|
||||||
|
:param target: where to deploy to
|
||||||
|
:type target: str | None
|
||||||
|
"""
|
||||||
|
if not target:
|
||||||
|
user = "cd"
|
||||||
|
host = env.SPCD_PROJECT_PATH
|
||||||
|
root = (
|
||||||
|
Path(os.sep) / user / projects.group / project.name / project.branch
|
||||||
|
)
|
||||||
|
target = f"{user}@{host}:{root}"
|
||||||
|
if not source:
|
||||||
|
source = "out"
|
||||||
|
ps.run(
|
||||||
|
"rsync",
|
||||||
|
"--archive",
|
||||||
|
"--delete-before",
|
||||||
|
"--verbose",
|
||||||
|
f"{source}/",
|
||||||
|
f"{target}/",
|
||||||
|
)
|
|
@ -5,4 +5,4 @@ inputs:
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- run: echo "synchronize"
|
- run: python3 -m "spcd" "synchronize"
|
||||||
|
|
Loading…
Reference in a new issue