Skip to content

Commit ef8ca15

Browse files
committed
Add justfile
1 parent c650ce8 commit ef8ca15

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ _store
2828
_site
2929
.sass-cache
3030
.devenv*
31+
.env

justfile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
set dotenv-load
2+
3+
# Display help information.
4+
help:
5+
@ just --list
6+
7+
# Open project workspace in VS Code.
8+
code:
9+
@ code codetalk.code-workspace
10+
11+
# Install tooling for working with the codetalk blog.
12+
[linux]
13+
install-tooling:
14+
@ just _install-tooling-all-platforms
15+
# Install imagemagick for mogrify.
16+
sudo apt install imagemagick
17+
18+
# Install tooling for working with the codetalk blog.
19+
[macos]
20+
install-tooling:
21+
@ just _install-tooling-all-platforms
22+
# Install imagemagick for mogrify.
23+
brew install imagemagick
24+
25+
_install-tooling-all-platforms:
26+
# Install stack.
27+
curl -sSL https://get.haskellstack.org/ | sh
28+
# Install ghcup.
29+
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
30+
# Install sass.
31+
npm i -g sass
32+
33+
# Setup dependencies and build the hakyll executable.
34+
setup project:
35+
stack build
36+
37+
# Deploy the blog to S3 and invalidate CloudFront cache.
38+
deploy:
39+
#!/usr/bin/env bash
40+
set -euxo pipefail
41+
just build
42+
# Sync files to S3.
43+
aws s3 sync _site s3://codetalk.io --delete
44+
# Invalidate Cloudflare cache.
45+
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE}/purge_cache" \
46+
-H "Authorization: Bearer ${CLOUDFLARE_TOKEN}" \
47+
-H "Content-Type: application/json" \
48+
--data '{"purge_everything":true}'
49+
50+
# Run hakyll development server in watch mode.
51+
dev project:
52+
stack exec -- hakyll-site watch
53+
54+
# Build blog artifacts and static files.
55+
build:
56+
./dist/hakyll-site clean || stack exec -- hakyll-site clean
57+
./dist/hakyll-site clean || stack exec -- hakyll-site build
58+
sass resources/scss/app.scss:_site/app.css --style compressed

0 commit comments

Comments
 (0)