-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
59 lines (51 loc) · 1.3 KB
/
justfile
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
# Note: Some of these commands require the Nu shell.
# Serve the site, including drafts
serve:
zola serve --drafts
alias server := serve
# Build the site and check for errors
check:
just build
zola check
# Test supported URLs for good responses
test:
#!/usr/bin/env zsh
pip3 install --quiet --requirement ./tests/requirements.txt
zola serve > /dev/null &
sleep 1
./tests/tests.py
kill %1
sleep 1 # Not sure why, but kill totally fails unless this sleep is here.
# Erase all built files in public/
clean:
rm -rf public/*
# Build
build: clean
zola build
# Build the site and push it via the deploy branch
deploy:
#!/usr/bin/env nu
if (git status --short | lines | length) > 0 {
print "There are unstaged changes" --stderr
exit 1
}
git switch deploy
git reset --hard main
just build
git add --force public
git commit --message "Build for deployment"
git push --force
git switch main
# Create a new post
post slug:
#!/usr/bin/env nu
cd content/post
cp .new.md '{{slug}}.md'
let newTitle = '{{slug}}' | str title-case
let newDate = date now | date format '%+'
(
open {{slug}}.md |
str replace DATE $newDate |
str replace TITLE $newTitle |
save -f {{slug}}.md
)