-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
123 lines (108 loc) · 3.19 KB
/
Taskfile.yml
File metadata and controls
123 lines (108 loc) · 3.19 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
# https://taskfile.dev
version: '3'
vars:
ENV: development
tasks:
install:
desc: Install pre-commit hooks
cmds:
- pre-commit install
- pre-commit gc
uninstall:
desc: Uninstall hooks
cmds:
- pre-commit uninstall
validate:
desc: Validate files with pre-commit hooks
cmds:
- pre-commit run --all-files
spell-check:
desc: Run spell check on markdown files
cmds:
- cspell --config .config/cspell.yaml "content/**/*.md"
clean-cache:
desc: Delete the Hugo Module cache for the current project.
silent: true
cmds:
- echo "Cleaning Hugo module cache"
- hugo mod clean --all
- rm -f .hugo_build.lock
clean:
desc: Delete the generated artifacts for this project.
deps: [clean-cache]
silent: true
cmds:
- echo "Cleaning up artifacts"
- rm -rf public
update:
desc: Updates project dependencies
silent: true
deps: [clean-cache]
cmds:
- echo "Updating Hugo modules"
- hugo mod get -u ./...
- hugo mod tidy
build:
desc: Builds the website package
deps: [clean]
silent: true
cmds:
- echo "Running build task for {{.ENV}}"
- |
echo "####################"
echo "Running hugo version"
hugo version
- |
echo "################"
echo "Running hugo env"
hugo env
- |
echo "##########"
echo "Build site"
git config --global --add safe.directory /__w/website/website
hugo --gc --minify --noBuildLock --enableGitInfo --cleanDestinationDir \
--printPathWarnings --printI18nWarnings \
--printMemoryUsage --printUnusedTemplates \
--templateMetrics --templateMetricsHints \
--environment {{.ENV}}
- |
echo "##############################"
echo "Avoid GitHub Jekyll processing"
touch public/.nojekyll
- |
{{if eq .ENV "production"}}
echo "####################################"
echo "Add CNAME config if it is production"
echo 'learn-software.com' > public/CNAME
{{end}}
submit-index-now:
desc: Submits Hugo site URLs to IndexNow endpoints
silent: true
platforms: [darwin, linux]
cmds:
- .github/workflows/scripts/index-now.sh
run-base:
desc: Start local server. Receives ENV argument. `ENV=production` will run in production mode. `ENV=development will use development mode.
silent: true
cmds:
- echo "=== Running in {{.ENV}} mode ==="
- hugo server --environment {{.ENV}} \
--bind 0.0.0.0 \
--printI18nWarnings --printMemoryUsage --printPathWarnings --printUnusedTemplates \
{{.EXTRA_SETTINGS}}
run-dev:
desc: Starts local server in development mode.
deps: [clean]
cmds:
- task: run-base
vars:
ENV: development
EXTRA_SETTINGS: "--buildDrafts --buildExpired --buildFuture --disableFastRender --navigateToChanged"
run-prod:
desc: Starts a local server in production mode.
deps: [clean, update]
cmds:
- task: run-base
vars:
ENV: production
EXTRA_SETTINGS: "--gc --minify --templateMetrics --ignoreCache"