about summary refs log tree commit diff stats
path: root/justfile
diff options
context:
space:
mode:
Diffstat (limited to 'justfile')
-rwxr-xr-xjustfile80
1 files changed, 80 insertions, 0 deletions
diff --git a/justfile b/justfile
new file mode 100755
index 0000000..22503ee
--- /dev/null
+++ b/justfile
@@ -0,0 +1,80 @@
+#! /usr/bin/env -S nix develop . --command just --justfile
+
+fly-system := "x86_64-linux"
+fly-registry := "registry.fly.io/alanpearce-eu"
+docker-tag := env_var_or_default("DOCKER_TAG", `date +%Y%m%d%H%M%S` + "-" + `git rev-parse --short HEAD`)
+started-at := `date +%s`
+
+default:
+    @just --list --justfile {{ justfile() }} --unsorted
+
+clean:
+	rm -r website
+
+check:
+    nix flake check . --print-build-logs
+
+check-licenses:
+    nix run nixpkgs#go-licenses check ./...
+
+check-links:
+	hyperlink website/public
+
+update-all:
+    go get -u all
+    gomod2nix --outdir nix
+    nix flake update
+
+watch-flake command:
+    watchexec --restart -w flake.nix -w flake.lock direnv exec . {{ command }}
+
+build:
+    go run ./cmd/build
+
+nix-build what:
+    nix build .#{{ what }}
+
+dev:
+	systemfd -s http::3000 -- modd
+
+docker-stream system=(arch() + "-linux"):
+    @nix build --print-out-paths .#docker-stream-{{ system }} | sh
+
+docker-image system=(arch() + "-linux"):
+    nix build .#docker-image-{{ system }}
+
+docker-stream-fly:
+    just docker-stream {{ fly-system }}
+
+docker-image-fly: (docker-image fly-system)
+
+docker-inspect image-path="result":
+    skopeo inspect docker-archive:{{ image-path }}
+
+print-docker-tag:
+    @echo {{ fly-registry }}:{{ docker-tag }}
+
+stream-to-registry :
+    just docker-stream-fly | gzip --fast | skopeo copy --dest-precompute-digests docker-archive:/dev/stdin docker://{{ fly-registry }}:{{ docker-tag }}
+
+push-to-registry:
+    skopeo copy --dest-precompute-digests docker-archive://`readlink -f result`  docker://{{ fly-registry }}:{{ docker-tag }}
+
+deploy-fly registry-and-tag=(fly-registry + ":" + docker-tag):
+    fly deploy --image {{ registry-and-tag }}
+
+deploy-vercel-preview: clean build
+	vercel pull --environment=preview
+	vercel deploy
+
+deploy-vercel: clean build check-links
+	vercel pull --environment=production
+	vercel deploy --prod
+
+deploy-netlify-preview: clean build
+	netlify deploy
+
+deploy-netlify: clean build check-links
+	netlify deploy --prodIfUnlocked
+
+deploy-production: deploy-vercel deploy-netlify