-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
170 lines (131 loc) · 4.06 KB
/
justfile
File metadata and controls
170 lines (131 loc) · 4.06 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
set dotenv-load
default: pelican
pelican:
uv run pelican
serve:
overmind start
livereload:
uv run inv livereload
upload:
uv run aws s3 sync \
--delete \
output \
s3://ideas.offby1.net
invalidate:
uv run aws cloudfront create-invalidation \
--distribution-id E3HG7SIR4ZZAS1 \
--paths "/*"
prepare_fonts:
rsync -pthrvz \
node_modules/@fortawesome/fontawesome-free/webfonts/ \
themes/offby1/static/webfonts/
rsync -pthrvz \
themes/offby1/fonts/ \
themes/offby1/static/webfonts/
clean:
rm -rf output/theme/.webassets-cache
rm -f output/theme/css/*.css
rm -rf cache/
build settings="pelicanconf.py": prepare_fonts (run_pelican settings)
run_pelican settings="pelicanconf.py":
uv run pelican --fatal=errors -s {{settings}} -o output content
debug settings="pelicanconf.py": prepare_fonts (run_debug_pelican settings)
run_debug_pelican settings="pelicanconf.py":
uv run pelican --fatal=errors -s {{settings}} -o output content --debug --log-handler=plain
generate: (build "publishconf.py")
generate-debug: (debug "publishconf.py")
generate-for-preview: install-deps prepare_fonts
#!/bin/bash
set -e
uv run pelican --fatal=errors\
-s publishconf.py \
-o output content \
--debug --log-handler=plain \
-e PHOTO_RESIZE_JOBS=1 "SITEURL=\"$DEPLOY_PRIME_URL\""
generate-dev: build
publish: generate upload invalidate
compile-deps:
uv lock
update-deps:
uv lock --upgrade
install-deps: install-python-deps install-node-deps
install-python-deps:
uv sync
install-node-deps:
npm install
setup-gha: install-deps
#!/usr/bin/env bash
# if GITHUB_PATH exists then we are in a GitHub Action, add the
# virtual environment and node_modules to the PATH
if [ -n "$GITHUB_PATH" ]; then
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/node_modules/.bin" >> $GITHUB_PATH
fi
deps: compile-deps install-deps
plan:
tofu plan -out plan.just
apply:
tofu apply plan.just
new_post:
uv run invoke new-post
# Verification tasks
check-code:
uv run ruff check .
uv run ruff format --check .
check-content:
uv run invoke list-categories > /dev/null
uv run invoke list-tags > /dev/null
check-links:
uvx --from linkchecker@10.5.0 linkchecker \
--ignore-url /tag/ \
--no-warnings \
output/
check-html:
#!/usr/bin/env bash
if [ ! -f "output/index.html" ]; then
echo "Missing index.html"
exit 1
fi
if ! grep -q "<html" output/index.html; then
echo "index.html missing HTML tag"
exit 1
fi
if ! grep -q "<title>" output/index.html; then
echo "index.html missing title tag"
exit 1
fi
check-feeds:
#!/usr/bin/env bash
if [ -f "output/feeds/all.atom.xml" ]; then
if ! python3 -c "import xml.etree.ElementTree as ET; ET.parse('output/feeds/all.atom.xml')"; then
echo "RSS feed is not valid XML"
exit 1
fi
fi
# Linting tasks (replaces pre-commit hooks)
lint-ruff:
uv run ruff check .
uv run ruff format --check .
lint-terraform:
#!/usr/bin/env bash
# Skip if no .tf files exist
if ! find . -name "*.tf" -not -path "./.terraform/*" -type f | grep -q .; then
echo "No Terraform files found, skipping terraform checks"
exit 0
fi
tofu fmt -check -recursive .
# Initialize terraform before validation
tofu init -backend=false
tofu validate
lint-rst:
#!/usr/bin/env bash
# Check for common RST mistakes (backticks without role) in .rst files only
# Exclude plugins/ and Just-Read/ directories
if find . -name "*.rst" -not -path "./plugins/*" -not -path "./Just-Read/*" -not -path "./.venv/*" -type f -exec grep -l -E '\`[^\`]+\`[^_]' {} \; 2>/dev/null | grep -q .; then
echo "Found bare backticks in RST files (should use :role:\`text\` or \`\`double backticks\`\`)"
find . -name "*.rst" -not -path "./plugins/*" -not -path "./Just-Read/*" -not -path "./.venv/*" -type f -exec grep -Hn -E '\`[^\`]+\`[^_]' {} \;
exit 1
fi
echo "RST backtick check passed"
lint: lint-ruff lint-terraform lint-rst
check: check-code check-content check-links check-html check-feeds