-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (58 loc) · 2.01 KB
/
Copy pathMakefile
File metadata and controls
67 lines (58 loc) · 2.01 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
.PHONY: serve serve-full invalidate deploy autodeploy deploy-local uva-arxiv schedule
UVA_ARXIV_PYTHON ?= python3
SCHEDULE_PYTHON ?= python3
define jekyll_serve
@mkdir -p /tmp/jekyll-status
@echo "idle" > /tmp/jekyll-status/uva-math
@trap 'rm -f /tmp/jekyll-status/uva-math' EXIT INT TERM; \
bundle exec jekyll serve $(1) 2>&1 | while IFS= read -r line; do \
printf '%s\n' "$$line"; \
case "$$line" in \
*"Regenerating:"*|*"Generating..."*) echo "building" > /tmp/jekyll-status/uva-math ;; \
*"done in"*) echo "done" > /tmp/jekyll-status/uva-math ;; \
*"ERROR"*) \
case "$$line" in \
*".well-known"*|*"ECONNRESET"*) ;; \
*) echo "error" > /tmp/jekyll-status/uva-math ;; \
esac ;; \
esac; \
done
endef
serve:
$(call jekyll_serve,--incremental)
serve-full:
$(call jekyll_serve,)
deploy:
@echo "Checking for changes..."
@if git diff --quiet && git diff --cached --quiet && [ -z "$$(git ls-files --others --exclude-standard)" ]; then \
echo "No changes detected. Creating/toggling trigger file..."; \
if [ -f trigger ]; then \
echo "Removing existing trigger file"; \
rm trigger; \
else \
echo "Creating trigger file"; \
touch trigger; \
fi; \
git add trigger; \
git commit -m "Trigger CI deployment" --signoff; \
else \
echo "Changes detected. Committing all changes..."; \
git add -A; \
git commit --verbose --signoff || echo "No changes to commit"; \
fi
@echo "Pushing to remote..."
@git push
@echo "Deployment complete!"
autodeploy:
@git add -A
@git commit -m "Update website content" || echo "No changes to commit"
@git push
deploy-local:
bundle exec jekyll build
find _site -name "*.html" -type f -exec sh -c 'grep -v "^[[:space:]]*$$" "$$1" > "$$1.tmp" && mv "$$1.tmp" "$$1"' _ {} \;
aws s3 sync ./_site/ s3://math.virginia.edu --delete --profile dept
uva-arxiv:
$(UVA_ARXIV_PYTHON) scripts/uva_arxiv/cli.py $(ARGS)
# Bare run reports what would change; make schedule ARGS=--write applies it.
schedule:
$(SCHEDULE_PYTHON) scripts/schedule/update.py $(ARGS)