ci: migrate GitHub actions to Gitea actions
Deploy CV Site (andreknie.de) / deploy (push) Canceled after 0s
Deploy CV Site (andreknie.de) / deploy (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from datetime import date
|
||||
import logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
# Add monorepo-cli src to path
|
||||
sys.path.insert(0, "/home/andre/coden/Orchestrator/shared/tools/monorepo-cli/src")
|
||||
|
||||
try:
|
||||
from monorepo.knowledge.sources.pdf import PDFSource
|
||||
from monorepo.knowledge.sources.docx import DocxSource
|
||||
from monorepo.knowledge.sources.base import SourceConfig
|
||||
except ImportError as e:
|
||||
print(f"Import error: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
target_dir = Path("/home/andre/coden/Orchestrator/privat/CV/andreknie.de/content/kniepunkt/")
|
||||
target_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
source_dir = Path("/home/andre/coden/Kniepunkt/KNIEPUNKTe")
|
||||
|
||||
print("Extracting PDFs...")
|
||||
pdf_source = PDFSource()
|
||||
pdf_config = SourceConfig(name="pdf_kniepunkte", type="pdf", params={"directory": str(source_dir)})
|
||||
pdf_result = pdf_source.extract(pdf_config, "privat")
|
||||
|
||||
print("Extracting DOCXs...")
|
||||
docx_source = DocxSource()
|
||||
docx_config = SourceConfig(name="docx_kniepunkte", type="docx", params={"directory": str(source_dir)})
|
||||
docx_result = docx_source.extract(docx_config, "privat")
|
||||
|
||||
artifacts = pdf_result.artifacts + docx_result.artifacts
|
||||
|
||||
print(f"Extracted {len(artifacts)} artifacts.")
|
||||
|
||||
for artifact in artifacts:
|
||||
title = artifact.metadata.title
|
||||
content = artifact.content
|
||||
|
||||
fm = f"---\ntitle: \"{title}\"\ndate: {date.today().isoformat()}\n---\n\n"
|
||||
|
||||
# Safe filename
|
||||
safe_title = "".join(c for c in title if c.isalnum() or c in " -_").strip().replace(" ", "-")
|
||||
if not safe_title:
|
||||
safe_title = artifact.file_path.stem
|
||||
|
||||
target_path = target_dir / f"{safe_title}.md"
|
||||
target_path.write_text(fm + content, encoding="utf-8")
|
||||
print(f"Written {target_path}")
|
||||
|
||||
print("Done.")
|
||||
Reference in New Issue
Block a user