diff options
Diffstat (limited to 'justfile')
-rwxr-xr-x | justfile | 83 |
1 files changed, 20 insertions, 63 deletions
diff --git a/justfile b/justfile index 22503ee..9c02f31 100755 --- a/justfile +++ b/justfile @@ -1,80 +1,37 @@ -#! /usr/bin/env -S nix develop . --command just --justfile +#!/usr/bin/env cached-nix-shell +#!nix-shell ci.nix -i "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` +docker_registry := "registry.fly.io/alanpearce-eu" +listen_address := env_var_or_default("LISTEN_ADDRESS", "::1") +tls_port := env_var_or_default("TLS_PORT", "8443") +port := env_var_or_default("PORT", "8080") default: - @just --list --justfile {{ justfile() }} --unsorted + @just --list --justfile {{ justfile() }} --unsorted clean: - rm -r website - -check: - nix flake check . --print-build-logs + rm -fr public check-licenses: - nix run nixpkgs#go-licenses check ./... + go-licenses check ./... check-links: - hyperlink website/public + hyperlink public --sources content 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 }} + npins update + go get -u all build: - go run ./cmd/build - -nix-build what: - nix build .#{{ what }} + templ generate + go run ./cmd/build 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 + systemfd -s https::{{ listen_address }}:{{ tls_port }} -s http::{{ listen_address }}:{{ port }} -- modd -deploy-netlify: clean build check-links - netlify deploy --prodIfUnlocked +ci: build check-links -deploy-production: deploy-vercel deploy-netlify +cd *DEPLOY_FLAGS: + fly auth docker + templ generate + fly deploy --image $(KO_DOCKER_REPO={{ docker_registry }} ko build --bare ./cmd/server) {{ DEPLOY_FLAGS }} |