Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 38 additions & 7 deletions .github/workflows/render-cv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- "assets/rendercv/design.yaml"
- "assets/rendercv/locale.yaml"
- "assets/rendercv/settings.yaml"
- ".github/workflows/render-cv.yml"
workflow_call:
workflow_dispatch:
permissions:
Expand All @@ -18,20 +19,44 @@ jobs:
name: RenderCV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Detect RenderCV input
id: detect
run: |
cv_file=$(find _data -maxdepth 1 -type f \( -name "cv.yaml" -o -name "cv.yml" \) -print -quit)
if [ -z "$cv_file" ]; then
echo "enabled=false" >> "$GITHUB_OUTPUT"
echo "::notice::RenderCV skipped because no CV data file exists."
exit 0
fi

if ! python - "$cv_file" <<'PY'
import re
import sys
from pathlib import Path

content = Path(sys.argv[1]).read_text(encoding="utf-8")
raise SystemExit(0 if re.search(r"(?m)^cv:\s*(?:#.*)?$", content) else 1)
PY
then
echo "enabled=false" >> "$GITHUB_OUTPUT"
echo "::notice::RenderCV skipped because $cv_file uses the legacy display-only format."
exit 0
fi

echo "enabled=true" >> "$GITHUB_OUTPUT"
echo "cv_file=$cv_file" >> "$GITHUB_OUTPUT"
- name: Install RenderCV
if: steps.detect.outputs.enabled == 'true'
run: |
pip install -r requirements.txt
- name: RenderCV
if: steps.detect.outputs.enabled == 'true'
run: |
cv_file=$(find _data -maxdepth 1 -type f \( -name "cv.yaml" -o -name "cv.yml" \))
if [ -z "$cv_file" ]; then
echo "No cv.yml file found!"
exit 1
fi
cv_file="${{ steps.detect.outputs.cv_file }}"
rendercv_dir=$(find assets -maxdepth 1 -type d -name "rendercv")
if [ -z "$rendercv_dir" ]; then
echo "No RenderCV config directory found!"
Expand All @@ -45,14 +70,20 @@ jobs:
rendercv render $cv_file --settings $settings
rm assets/rendercv/rendercv_output/*.typ
- name: Upload rendercv_output as an artifact
if: steps.detect.outputs.enabled == 'true'
uses: actions/upload-artifact@v4
with:
name: RenderCV Output
path: assets/rendercv/rendercv_output
- name: Push the changes
if: steps.detect.outputs.enabled == 'true'
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "RenderCV output is already up to date."
exit 0
fi
git commit -m "chore: render the latest CV"
git push