Skip to content

refactor: rename std README.md to _index.md for Zola #65

refactor: rename std README.md to _index.md for Zola

refactor: rename std README.md to _index.md for Zola #65

Workflow file for this run

name: Sync Standard Library Documentation
on:
push:
branches:
- main
jobs:
sync-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Docs Repository
uses: actions/checkout@v4
with:
path: 'docs-repo'
- name: Checkout Website Repository
uses: actions/checkout@v4
with:
repository: 'zenc-lang/www'
token: ${{ secrets.WEBSITE_REPO_TOKEN }}
path: 'website'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Split Language Reference
run: |
cd docs-repo
python3 scripts/split_reference.py
- name: Validate Internal Links
run: |
cd docs-repo
python3 scripts/validate_links.py content
- name: Sync Files to Website Repo
run: |
# The website repo structure uses suffix-based localization: filename.lang.md
# We rsync the whole content directory including localized _index.lang.md files.
rsync -avz --delete docs-repo/content/ website/docs.zenc-lang.org/content/
# Sync config.toml (Source of truth is docs/site/config.toml)
cp docs-repo/site/config.toml website/docs.zenc-lang.org/config.toml
# Ensure all synced files have frontmatter (if missing) and clean Rosetta templates
find website/docs.zenc-lang.org/content/ -name "*.md" | while read file; do
# 1. Clean Rosetta templates ({{trans|...}})
sed -i 's/{{trans|.*}}//g' "$file"
# 2. Add frontmatter if missing (Zola requires +++ delimeters)
if ! head -n 1 "$file" | grep -q "^+++"; then
TITLE=$(grep -m 1 "^# " "$file" | sed 's/^# //; s/"/\\"/g' || echo "Documentation")
TEMP=$(mktemp)
echo "+++" > "$TEMP"
echo "title = \"$TITLE\"" >> "$TEMP"
echo "+++" >> "$TEMP"
echo "" >> "$TEMP"
cat "$file" >> "$TEMP"
mv "$TEMP" "$file"
fi
done
- name: Commit and Push to Website Repo
run: |
cd website
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs.zenc-lang.org/content/
git diff --quiet && git diff --staged --quiet || (git commit -m "docs: auto-sync documentation and rosetta examples" && git push)