all repos — homestead @ 02344e6cb41515516464de403e2eae1caac81e5c

Code for my website

justfile (view raw)

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
#!/usr/bin/env nix
#!nix develop ``.#ci`` --command just --justfile

docker_registry := "registry.fly.io/alanpearce-eu"
docker-tag := env_var_or_default("DOCKER_TAG", `date -u +%Y%m%d%H%M%S` + "-" + `git rev-parse --short HEAD`)
listen_address := env_var_or_default("SERVER_LISTEN_ADDRESS", "::1")
port := env_var_or_default("SERVER_PORT", "8080")
website_repo := env_var_or_default("SOURCE", "../website")

default:
	@just --list --justfile {{ justfile() }} --unsorted

clean:
	rm -fr public

check-licenses:
	go-licenses check ./...

check-links: (build "--compress=false")
	hyperlink public --sources {{ website_repo }}

update-all:
	nix flake update
	go get -u all
	gomod2nix

build *BUILD_FLAGS:
	SOURCE={{ website_repo }} go run ./cmd/build {{ BUILD_FLAGS }}

run: dev

dev:
	systemfd -s http::{{ listen_address }}:{{ port }} -- modd

build-nix-package:
    nix build .#build

ci: check-links build-nix-package

cd *DEPLOY_FLAGS: && (deploy DEPLOY_FLAGS)
	fly auth docker

deploy *DEPLOY_FLAGS:
	fly deploy --image $(KO_DOCKER_REPO={{ docker_registry }} ko build --platform linux/amd64 --sbom none --bare --tags {{ docker-tag }} .) {{ DEPLOY_FLAGS }}