Merge branch 'refactor: migrate to calepin'
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
commit
6cd5ed61c4
212 files changed
+929
-26
No files matched your search
@@ -0,0 +1,71 @@
|
||||
name: Build site
|
||||
|
||||
on:
|
||||
- push
|
||||
- workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# NOTE: must match your act_runner labels (e.g. ubuntu-latest, ubuntu-24.04).
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Bootstrap pinned toolchain
|
||||
run: ./scripts/bootstrap.sh
|
||||
|
||||
- name: Build site
|
||||
run: ./scripts/calepin.sh compile site public
|
||||
|
||||
# The official upload-artifact@v4 refuses to run on Gitea (it detects a
|
||||
# non-GitHub server and aborts with GHESNotSupportedError). v3 uses the
|
||||
# artifact API that Gitea implements. On Gitea >= 1.22 with a current
|
||||
# act_runner, christopherhx/gitea-upload-artifact@v4 is a drop-in
|
||||
# replacement if you want the v4 API.
|
||||
- name: Upload site artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: public
|
||||
path: public/
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
# Publish only from main; move the gate to publish from another branch.
|
||||
if: github.ref == 'refs/heads/main'
|
||||
# Write access for the automatic Actions token to push the pages branch.
|
||||
permissions:
|
||||
contents: write
|
||||
# NOTE: must match your act_runner labels (e.g. ubuntu-latest, ubuntu-24.04).
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download site artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: public
|
||||
path: public
|
||||
|
||||
- name: Check artifact layout
|
||||
run: test -f public/index.html
|
||||
|
||||
# Publishing interfaces with prod; it never runs under local act tests
|
||||
# (act sets env.ACT, the Gitea runner does not). The force-push to the
|
||||
# `pages` branch is what triggers the git-pages webhook.
|
||||
- name: Publish to pages branch
|
||||
if: ${{ !env.ACT }}
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$GITEA_TOKEN" ]; then
|
||||
echo "::error::Missing GITEA_TOKEN (the automatic Actions token)."
|
||||
exit 1
|
||||
fi
|
||||
cd public
|
||||
git init -q -b pages .
|
||||
git config user.name "Yggdrasil CI"
|
||||
git config user.email "ci@noreply.kb28.ch"
|
||||
git add -A
|
||||
git commit -q -m "Publish site from ${GITHUB_SHA}"
|
||||
repo_host="${GITHUB_SERVER_URL#*://}"
|
||||
repo_host="${repo_host%/}"
|
||||
git push -q --force "https://${GITHUB_REPOSITORY_OWNER}:${GITEA_TOKEN}@${repo_host}/${GITHUB_REPOSITORY}.git" pages
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
# Generated site and pinned toolchain
|
||||
public/
|
||||
tools/
|
||||
|
||||
# Calepin build artifacts
|
||||
.calepin/
|
||||
.calepin-entry.*
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
@@ -0,0 +1,20 @@
|
||||
# Agent Rules for Yggdrasil Migration
|
||||
|
||||
* **Commit Policy**: Small conventional commits. One logical change per
|
||||
commit, committed only once that step is verified and working. End every
|
||||
commit message with a blank line followed by an
|
||||
`Assisted-by: Delta:zai-glm-5.3` footer.
|
||||
* **Layout**: Sources live in `site/` (`calepin.toml` + `.typ` pages),
|
||||
generated output in `public/` (gitignored), pinned binaries in `tools/`
|
||||
(gitignored), helper scripts in `scripts/`, and the old Docsify
|
||||
documentation stays untouched in `legacy_docs/`.
|
||||
* **Toolchain**: `calepin` (0.0.61) and `typst` (0.15.1) are pinned in
|
||||
`scripts/bootstrap.sh` and downloaded into `tools/` with checksum
|
||||
verification. The build must never depend on global installs. CI installs
|
||||
the same pinned versions by calling the same scripts.
|
||||
* **Verification**: Before committing, run a fresh cycle: `rm -rf tools`,
|
||||
then `just clean`, then `just build` — the build must succeed with no
|
||||
calepin on `PATH`. Verify the served site (`just preview`): home 200,
|
||||
category page 200, sub-page 200, missing page shows the 404 page,
|
||||
`sitemap.xml` present. After every test/clean cycle `git status` must stay
|
||||
clean.
|
||||
@@ -0,0 +1,27 @@
|
||||
# Show the available recipes
|
||||
default:
|
||||
@just --list
|
||||
|
||||
# Bootstrap the pinned calepin + typst binaries into tools/
|
||||
tools:
|
||||
./scripts/bootstrap.sh
|
||||
|
||||
# Compile the site into public/
|
||||
build: tools
|
||||
./scripts/calepin.sh compile site public
|
||||
|
||||
# Build, then serve the site locally
|
||||
preview: build
|
||||
./scripts/calepin.sh serve public
|
||||
|
||||
# Rebuild on change and serve the result
|
||||
watch: tools
|
||||
./scripts/calepin.sh watch site public --serve
|
||||
|
||||
# Remove generated output and build caches
|
||||
clean:
|
||||
./scripts/clean.sh
|
||||
|
||||
# Run the CI workflow locally with act (requires act + docker)
|
||||
ci:
|
||||
act push -W .gitea/workflows/build.yml -j build --artifact-server-path /tmp/act-artifacts
|
||||
@@ -1,33 +1,88 @@
|
||||
<header>
|
||||
<h1>Yggdrasil</h1>
|
||||
</header>
|
||||
Yggdrasil is a collections of notes around IT, OT and other geeks stuff
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
# Yggdrasil
|
||||
|
||||
# [Bachelor in embedded system](/infotro/)
|
||||
Here notes I take during my bachelor in embedded systems
|
||||
Personal knowledge base built as a static website with
|
||||
[Calepin](https://vincentarelbundock.github.io/calepin/), a Typst-based static
|
||||
site generator.
|
||||
|
||||
Mainly some topics:
|
||||
- [PTR - Programmation Temps Réel](/infotro/PTR/)
|
||||
- [SDi - Système Distribué](/infotro/SDi/)
|
||||
- [Eln - Électronique](/infotro/Eln/)
|
||||
- [SEm - Systèmes Embarqué](/infotro/SEm/)
|
||||
## Layout
|
||||
|
||||
# [Master of science in engineering in embedded system](/MSE/)
|
||||
Here note I take during my Master of science un engineering with embedded system as orientation
|
||||
- `site/` — website sources: `calepin.toml` + `.typ` pages
|
||||
- `site/themes/yggdrasil/` — local theme extending the bundled `calepin` theme (scoped sidebars, academic-styled landing)
|
||||
- `public/` — generated site (gitignored)
|
||||
- `tools/` — pinned `calepin` and `typst` binaries (gitignored, downloaded on demand)
|
||||
- `scripts/` — helper scripts used by the Justfile and CI
|
||||
- `legacy_docs/` — the old Docsify documentation, kept unmodified for reference
|
||||
|
||||
Mainly some topics:
|
||||
- [SRE - Software Reverse Engineering](/MSE/SRE/)
|
||||
## Quick start
|
||||
|
||||
# [Embedded Systems](/Embed/)
|
||||
Here some note specific about some Embedded System
|
||||
- [STM32](/Embed/STM32/)
|
||||
- [nRF](/Embed/nRF/)
|
||||
`just` is the only prerequisite — the toolchain is downloaded and
|
||||
checksum-verified into `tools/` on first use (no global installs, no cargo):
|
||||
|
||||
# [Working environment at HES-SO](/HES-SO/)
|
||||
Here some note about the working environment at HES-SO
|
||||
just # list recipes
|
||||
just tools # download the pinned toolchain into tools/
|
||||
just build # compile site/ into public/
|
||||
just preview # build, then serve the site locally
|
||||
just watch # rebuild on change and serve
|
||||
just clean # remove public/ and build caches
|
||||
just ci # run the CI workflow locally with act (needs act + docker)
|
||||
|
||||
- [OneDrive - Linux](/HES-SO/OneDrive.md)
|
||||
- [Teams - Linux](/HES-SO/Teams.md)
|
||||
## Adding a page
|
||||
|
||||
Create `site/<category>/<page>.typ`:
|
||||
|
||||
```typst
|
||||
#set document(title: [Page title])
|
||||
#metadata((title: "Page title", translation_key: "category-page")) <website-metadata>
|
||||
|
||||
#title()
|
||||
|
||||
= Page title
|
||||
|
||||
Content…
|
||||
```
|
||||
|
||||
and reference it in `site/calepin.toml`:
|
||||
|
||||
```toml
|
||||
[[sidebar.section.item]]
|
||||
target = "<category>/<page>.typ"
|
||||
```
|
||||
|
||||
Sidebar labels come from the page's `#metadata(...)` line, not from the config.
|
||||
|
||||
Every page also renders a printable PDF twin (`pdf = true` in
|
||||
`calepin.toml`, selectable in the page's view picker). Add `pdf: false` to a
|
||||
page's `#metadata(...)` to skip its PDF, as `404.typ` does.
|
||||
|
||||
## Adding a category
|
||||
|
||||
1. Create `site/<category>/` with an `index.typ`, using
|
||||
`#metadata((title: "Overview", ...))` for its sidebar label.
|
||||
2. Add a `[[sidebar.section]]` named after the category in `calepin.toml`,
|
||||
listing the index page and its sub-pages.
|
||||
3. Add a `[[menus.main]]` entry with the category's `index.typ` as `target`
|
||||
and the category name as `label` (e.g. `Home`, `IT`), so it appears in the
|
||||
top navigation bar. The `label` is required here because the index page's
|
||||
metadata title is `Overview`.
|
||||
|
||||
Pages inside a category show only that category's sidebar section — the
|
||||
local theme (`site/themes/yggdrasil/partials/site-nav-sidebar.html`) filters
|
||||
the sidebar to the section containing the current page. Pages outside every
|
||||
category (landing page, `404`, standalone pages) fall back to the full
|
||||
sidebar.
|
||||
|
||||
## Deployment
|
||||
|
||||
`just build` produces a fully static site in `public/`: HTML pages with
|
||||
printable PDF twins, plus `sitemap.xml`, `robots.txt`, and `llms.txt`. The
|
||||
Gitea Actions workflow in
|
||||
`.gitea/workflows/build.yml` builds the site on every push with the same
|
||||
pinned toolchain and uploads `public/` as an artifact.
|
||||
|
||||
Pushes to `main` are also published: the `deploy` job force-pushes `public/`
|
||||
to the repo's `pages` branch using the automatic Actions token (no secrets to
|
||||
configure). A Gitea webhook on the repo then notifies the self-hosted
|
||||
[git-pages](https://codeberg.org/git-pages/git-pages) server, which clones
|
||||
the `pages` branch and serves the site. The push step is gated with
|
||||
`if: ${{ !env.ACT }}` so local `act` runs never publish, and
|
||||
`workflow_dispatch` enables manual publishes from the Gitea UI.
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 212 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user