Compare commits
4
Commits
af31b6165c
...
1adca36802
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1adca36802
|
||
|
|
3b1ef34bce
|
||
|
|
6b33be6956
|
||
|
|
f94a5cbe17
|
No files matched your search
@@ -1,6 +1,8 @@
|
||||
name: Build site
|
||||
|
||||
on: push
|
||||
on:
|
||||
- push
|
||||
- workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -16,8 +18,54 @@ jobs:
|
||||
- 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@v4
|
||||
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
|
||||
@@ -21,3 +21,7 @@ watch: tools
|
||||
# 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
|
||||
@@ -24,6 +24,7 @@ checksum-verified into `tools/` on first use (no global installs, no cargo):
|
||||
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)
|
||||
|
||||
## Adding a page
|
||||
|
||||
@@ -49,6 +50,10 @@ 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
|
||||
@@ -68,8 +73,16 @@ sidebar.
|
||||
|
||||
## Deployment
|
||||
|
||||
`just build` produces a fully static site in `public/`: HTML pages plus
|
||||
`sitemap.xml`, `robots.txt`, and `llms.txt`. The Gitea Actions workflow in
|
||||
`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 for deployment to any
|
||||
static host.
|
||||
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.
|
||||
@@ -1,4 +1,5 @@
|
||||
#set document(title: [Not found])
|
||||
#metadata((pdf: false)) <website-metadata>
|
||||
|
||||
#title()
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ title = "Yggdrasil"
|
||||
description = "Personal knowledge base."
|
||||
base-url = "https://yggdrasil.kb28.ch"
|
||||
theme = "themes/yggdrasil"
|
||||
pdf = false
|
||||
pdf = true
|
||||
minify = true
|
||||
search = "pagefind"
|
||||
logo = "assets/yggdrasil.svg"
|
||||
|
||||
Reference in new issue
Block a user