Browse Source

Deployment script

master
David Larlet 1 year ago
parent
commit
6f6da392ca
No known key found for this signature in database
2 changed files with 14 additions and 4 deletions
  1. 13
    4
      famille.py
  2. 1
    0
      requirements.txt

+ 13
- 4
famille.py View File

@@ -6,9 +6,10 @@ from pathlib import Path
from time import perf_counter

import markdown
import minicli
from jinja2 import Environment as Env
from jinja2 import FileSystemLoader
from minicli import cli, run, wrap
from usine import connect, run

HERE = Path(".")
FAMILLE = HERE / "famille"
@@ -39,14 +40,21 @@ def collection():
)


@cli
@minicli.cli
def generate():
template = environment.get_template("histoire.html")
page = template.render(chapters=collection())
open(FAMILLE / "histoire" / "index.html", "w").write(page)


@wrap
@minicli.cli
def deploy():
repository = "gitea-repositories/davidbgk/larlet-fr-famille.git"
run(f"git archive --remote={repository} master | tar -x -C larlet-fr/famille")
print("Deployment done.")


@minicli.wrap
def perf_wrapper():
start = perf_counter()
yield
@@ -55,4 +63,5 @@ def perf_wrapper():


if __name__ == "__main__":
run()
with connect(hostname="larlet@ssh-larlet.alwaysdata.net"):
minicli.run()

+ 1
- 0
requirements.txt View File

@@ -1,3 +1,4 @@
Jinja2==2.10.3
Markdown==3.1.1
minicli==0.4.4
usine==0.2.2

Loading…
Cancel
Save