forked from qgis/QGIS-Website
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
100 lines (79 loc) · 4.38 KB
/
Makefile
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
help:
@echo "QGIS Website"
@echo
@echo "Brought to you by Kartoza (Pty) Ltd."
@echo
@echo "Help for using this Makefile"
@echo
@echo "For detailed help please visit:"
@echo "https://github.com/QGIS/QGIS-Website"
@echo
@echo "------------------------------------------------------------------"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m - %s\n", $$1, $$2}'
# ----------------------------------------------------------------------------
# D O C K E R C O M M A N D S
# ----------------------------------------------------------------------------
dev-build: ## Generate the development docker container
docker build --rm -f Dockerfile.dev -t qgis_hugo_dev:latest .
dev: dev-build ## Run the development hugo container
docker run --rm -it -v "$${PWD}":/app -w /app -p $${HOST_IP:-127.0.0.1}:1313:1313 qgis_hugo_dev:latest
dev-metrics: dev-build ## Run the development hugo container with metrics
docker run --rm -it -v "$${PWD}":/app -w /app -p $${HOST_IP:-127.0.0.1}:1313:1313 qgis_hugo_dev:latest serve -D --bind 0.0.0.0 --templateMetrics --templateMetricsHints
deploy-prod: ## Deploy everything to production
docker build -t qgis.org .
docker-compose -f ~/docker-compose.yml up -d qgis_hugo_prod
docker image prune -af
tests: ## Run the test suite
docker build --rm -f Dockerfile.tests -t qgis_hugo_tests:latest .
docker run --rm --net=host --volume "$${PWD}":/app -w /app qgis_hugo_tests:latest
# ----------------------------------------------------------------------------
# P R O D U C T I O N C O M M A N D S
# ----------------------------------------------------------------------------
build: ## Build the site for nocache.qgis.org, www.qgis.org and qgis.org
@echo
@echo "------------------------------------------------------------------"
@echo "Building site in production"
@echo "------------------------------------------------------------------"
./scripts/get_commit_hash.sh
hugo --config config.toml,config/config.nocache.toml
hugo --config config.toml,config/config.prod.toml
hugo --config config.toml,config/config.www.toml
deploy: ## Deploy the site for nocache.qgis.org, www.qgis.org and qgis.org
@echo
@echo "------------------------------------------------------------------"
@echo "Deploy site in production"
@echo "------------------------------------------------------------------"
git pull && rm -rf archive; mkdir archive; mv public_www public_prod public_nocache archive; make build
revert-deploy: ## Revert the site for nocache.qgis.org, www.qgis.org and qgis.org
@echo
@echo "------------------------------------------------------------------"
@echo "Revert to the previous state in production"
@echo "------------------------------------------------------------------"
rm -rf public_www public_prod public_nocache; cp -r archive/public_www archive/public_prod archive/public_nocache ./
# ----------------------------------------------------------------------------
# D E V E L O P M E N T C O M M A N D S
# ----------------------------------------------------------------------------
hugo-dev-build: ## Build the site locally and run a python server at localhost:8000 with hugo
@echo
@echo "------------------------------------------------------------------"
@echo "Building site in development"
@echo "------------------------------------------------------------------"
hugo --config config.toml,config/config.dev.toml
python3 -m http.server 8000 -d public_dev
hugo-run-dev: ## Run the server at localhost:1313 with hugo
@echo
@echo "------------------------------------------------------------------"
@echo "Building site in development"
@echo "------------------------------------------------------------------"
hugo server --config config.toml,config/config.dev.toml
# ----------------------------------------------------------------------------
# U T I L S C O M M A N D S
# ----------------------------------------------------------------------------
csv/schedule.csv scripts/schedule.ics data/conf.json:
python scripts/update-schedule.py
clearschedule:
$(RM) csv/schedule.csv data/conf.json
schedule: clearschedule csv/schedule.csv scripts/schedule.ics data/conf.json ## Update schedule after release
git pull --autostash --rebase
git commit -a -m "Update for $(shell jq -r '.release' data/conf.json)/$(shell jq -r '.ltrrelease' data/conf.json) point releases"
.PHONY: schedule