generated from alecodes/base-template
34 lines
998 B
Makefile
34 lines
998 B
Makefile
set dotenv-load := true
|
|
|
|
bin_name := "compendium"
|
|
release_mode := "dev"
|
|
container_registry := "git.alecodes.page/alecodes"
|
|
container_image_name := container_registry / bin_name
|
|
|
|
# Start dev server
|
|
dev:
|
|
watchexec --clear --restart --watch=src cargo run {{ if release_mode == "prod" { "--release" } else { "" } }}
|
|
|
|
# Build the container locally
|
|
build:
|
|
podman build --tag {{ container_image_name }}:latest --cache-to {{ container_image_name }}-cache --cache-from {{ container_image_name }}-cache .
|
|
|
|
# Run tests
|
|
test:
|
|
cargo test
|
|
|
|
# Publish the project to the container registry
|
|
publish +TAGS='latest':
|
|
for tag in {{ TAGS }}; do podman push {{ container_image_name }}:latest {{ container_image_name }}:${tag}; done
|
|
podman push {{ container_image_name }}:latest {{ container_image_name }}:$(git rev-parse --short HEAD)
|
|
|
|
deploy:
|
|
|
|
# Delete build artifacts
|
|
clean:
|
|
podman system prune --build
|
|
cargo clean
|
|
|
|
# Bump crate version, this will also publish it
|
|
bump:
|
|
cog bump --auto
|