Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: pages

# Build the wiki with m2 site build and publish it to https://tamnd.github.io/math2.
# The nightly run picks up changes to the toolchain and the spec in tamnd/math2-agent.
# The nightly run picks up changes to the toolchain and the spec in tamnd/math2-agent, and to the Wikipedia scope in tamnd/wikipedia-math.
on:
push:
branches: [main]
Expand Down Expand Up @@ -33,6 +33,12 @@ jobs:
repository: tamnd/math2-agent
ref: main
path: toolchain
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: tamnd/wikipedia-math
ref: main
path: wikipedia
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: toolchain/go.mod
Expand All @@ -44,7 +50,7 @@ jobs:
env:
COMMIT: ${{ github.sha }}
run: |
"$RUNNER_TEMP/m2" site build -content content -spec toolchain/spec -out _site -url https://tamnd.github.io/math2 -commit "$COMMIT" -date now
"$RUNNER_TEMP/m2" site build -content content -spec toolchain/spec -wikipedia wikipedia -out _site -url https://tamnd.github.io/math2 -commit "$COMMIT" -date now
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: _site
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Each node is one file. A node is a concept, a definition, a statement, a conject

The toolchain that builds and checks this content is in [tamnd/math2-agent](https://github.com/tamnd/math2-agent).

Read the content as a wiki at https://math2.tamnd.com. Each node has a page for people and a copy for programs: Markdown, JSON and `llms.txt`. A build server runs `scripts/deploy-cloudflare.sh` every 5 minutes, and it publishes the wiki to Cloudflare Pages when `main` of this repository or of tamnd/math2-agent changes. A change on `main` is on the wiki in 5 to 10 minutes. A mirror of the wiki is at https://tamnd.github.io/math2. The workflow `pages` builds it on GitHub Actions on each push to `main` and each night, so it can be some hours behind.
Read the content as a wiki at https://math2.tamnd.com. Each node has a page for people and a copy for programs: Markdown, JSON and `llms.txt`. A build server runs `scripts/deploy-cloudflare.sh` every 5 minutes, and it publishes the wiki to Cloudflare Pages when `main` of this repository, of tamnd/math2-agent or of tamnd/wikipedia-math changes. The page Wikipedia scope shows the articles that the Wikipedia corpus takes, from [tamnd/wikipedia-math](https://github.com/tamnd/wikipedia-math). A change on `main` is on the wiki in 5 to 10 minutes. A mirror of the wiki is at https://tamnd.github.io/math2. The workflow `pages` builds it on GitHub Actions on each push to `main` and each night, so it can be some hours behind.

## Status

Expand Down
9 changes: 5 additions & 4 deletions scripts/deploy-cloudflare.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# Build the wiki of tamnd/math2 and publish it to Cloudflare Pages at https://math2.tamnd.com.
#
# Run it from cron on a build server, for example every 5 minutes: */5 * * * * $HOME/math2-deploy/deploy-cloudflare.sh >> $HOME/math2-deploy/deploy.log 2>&1. The server needs git, Go, Node and flock. It fetches main of tamnd/math2 and tamnd/math2-agent, and it does nothing when the two commits are the same as at the last deploy. Use -f to deploy again.
# Run it from cron on a build server, for example every 5 minutes: */5 * * * * $HOME/math2-deploy/deploy-cloudflare.sh >> $HOME/math2-deploy/deploy.log 2>&1. The server needs git, Go, Node and flock. It fetches main of tamnd/math2, tamnd/math2-agent and tamnd/wikipedia-math, and it does nothing when the three commits are the same as at the last deploy. Use -f to deploy again.
#
# The file $M2_DEPLOY/cloudflare.env must set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID. Keep it at mode 600.
set -eu
Expand Down Expand Up @@ -33,15 +33,16 @@ sync() {

content=$(sync content math2)
toolchain=$(sync toolchain math2-agent)
state="$content $toolchain"
wikipedia=$(sync wikipedia wikipedia-math)
state="$content $toolchain $wikipedia"
if [ "$force" != "-f" ] && [ -f "$dir/deployed" ] && [ "$(cat "$dir/deployed")" = "$state" ]; then
exit 0
fi

echo "$(date -u +%FT%TZ) deploy math2 $content, math2-agent $toolchain"
echo "$(date -u +%FT%TZ) deploy math2 $content, math2-agent $toolchain, wikipedia-math $wikipedia"
(cd "$dir/toolchain" && go build -trimpath -o "$dir/m2" ./cmd/m2)
rm -rf "$dir/site"
"$dir/m2" site build -content "$dir/content" -spec "$dir/toolchain/spec" -out "$dir/site" -url "$url" -commit "$content" -date now -cloudflare
"$dir/m2" site build -content "$dir/content" -spec "$dir/toolchain/spec" -wikipedia "$dir/wikipedia" -out "$dir/site" -url "$url" -commit "$content" -date now -cloudflare
files=$(find "$dir/site" -type f | wc -l)
big=$(find "$dir/site" -type f -size +24M | head -1)
if [ "$files" -gt "$limit" ] || [ -n "$big" ]; then
Expand Down
Loading