1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# branch pushes publish only when the docs, devlog or publish tooling change
# (the same list the publish step checks); tag pushes always publish.
when:
- event: ["push"]
branch: ["main"]
paths: [README.md, CHANGELOG.md, "docs/**", "devlog/**", "examples/*.md", scripts/publish-docs.zig, .tangled/workflows/publish-standard-records.yml]
- event: ["push"]
tag: ["v*"]
engine: nixery
clone:
depth: 50
dependencies:
nixpkgs:
- coreutils
- curl
- git
- gnutar
- xz
steps:
- name: install pinned zig
command: scripts/ci-zig.sh /tangled/workspace/.zig
- name: fetch dependencies
command: |
# tangled.org rate-limits archive downloads; three workflows fetching at
# once on every push has tripped it. retry with backoff before building.
ok=0
for attempt in 1 2 3 4 5; do
if /tangled/workspace/.zig/zig build --fetch; then ok=1; break; fi
echo "dependency fetch attempt $attempt failed; retrying" >&2
sleep $((attempt * 15))
done
[ "$ok" = 1 ]
- name: build and publish docs to ATProto
command: |
set -e
# branch pushes publish only when docs, devlog, or the publish tooling
# changed; tag pushes always publish. pure shell — grep is not in the image.
if [ "${TANGLED_REF#refs/tags/}" = "$TANGLED_REF" ]; then
publish=0
for f in $(git diff-tree --no-commit-id --name-only -r HEAD); do
case "$f" in
README.md|CHANGELOG.md|docs/*|devlog/*|examples/*.md|scripts/publish-docs.zig|.tangled/workflows/publish-standard-records.yml)
publish=1 ;;
esac
done
if [ "$publish" -eq 0 ]; then
echo "no docs/devlog changes; skipping ATProto docs publish"
exit 0
fi
fi
if [ -z "$ATPROTO_PASSWORD" ]; then
echo "ATPROTO_PASSWORD is not set; cannot publish docs" >&2
exit 1
fi
/tangled/workspace/.zig/zig build
./zig-out/bin/publish-docs