-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
92 lines (73 loc) · 1.99 KB
/
justfile
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
VERSION := "0.11.0"
APP := "showcert"
DOCKER_IMAGE := "andreburgaud" / APP
BUILD_DIR := "build"
DEBUG_DIR := BUILD_DIR / "debug"
alias c := clean
alias t := test
alias v := version
alias ghp := github-push
alias dc := docker-clean
alias dp := docker-push
alias cr := check-release
alias db := dev-build
alias rel := release
alias lrel := local-release
# Default recipe (this list)
default:
@just --list
# Clean binaries
clean:
-rm -rf tmp
-rm -rf dist
# Create certs for testing
create_certs:
./create_certs.sh
# Execute tests
test:
go test -v ./...
# Build showcert debug version (needed for GitHub Actions)
build:
go build -o {{DEBUG_DIR}}/{{APP}} {{APP}}/cmd/{{APP}}
# Lint with golangci-lint
lint:
golangci-lint run
# Check release configuration
check-release:
goreleaser check
# Build a release and publish to GitHub
release:
goreleaser release --clean
# Build a local snapshot release
local-release:
goreleaser release --clean --snapshot
# Local development build
dev-build:
goreleaser build --clean --single-target --snapshot
# Build a local docker image
docker:
docker buildx build -t {{DOCKER_IMAGE}} .
docker buildx build --build-arg SHOWCERT_VERSION={{VERSION}} -t {{DOCKER_IMAGE}}:{{VERSION}} .
# Run docker scout (image scan)
docker-scout:
docker scout cves andreburgaud/showcert:{{VERSION}}
# Push showcert docker image to docker hub
docker-push: docker
docker push docker.io/{{DOCKER_IMAGE}}:{{VERSION}}
docker tag {{DOCKER_IMAGE}}:{{VERSION}} docker.io/{{DOCKER_IMAGE}}:latest
docker push docker.io/{{DOCKER_IMAGE}}:latest
# Clean local images
docker-clean:
docker rmi -f $(docker images | grep {{APP}} | tr -s ' '| cut -d ' ' -f 3)
docker rmi $(docker images -f dangling=true -q)
# Format Go code
fmt:
gofmt -w .
# Push and tag the code to Github
github-push: version
@git push
@git tag -a {{VERSION}} -m "Version {{VERSION}}"
@git push origin --tags
# Display the version
version:
@echo "version {{VERSION}}"