generated from actions/container-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·76 lines (60 loc) · 2.23 KB
/
Makefile
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
# -------------
# VARIABLES
# -------------
# Git variables
GIT_REPOSITORY_NAME := $(shell basename `git rev-parse --show-toplevel`)
GIT_VERSION := $(shell git describe --always --tags --long --dirty | sed -e 's/\-0//' -e 's/\-g.......//')
# Docker variables
DOCKER_IMAGE_TAG ?= $(GIT_REPOSITORY_NAME):$(GIT_VERSION)
DOCKER_IMAGE_NAME := senzing/git-action-slack-notification
# -------------
# TASKS
# -------------
.PHONY: fmt
fmt:
@gofmt -w -s -d configuration
@gofmt -w -s -d main.go
.PHONY: build
build: fmt
@go mod download && \
go get ./... && \
go install ./...
# -----------------------------------------------------------------------------
# The first "make" target runs as default.
# -----------------------------------------------------------------------------
.PHONY: default
default: help
# -----------------------------------------------------------------------------
# Docker-based builds
# -----------------------------------------------------------------------------
.PHONY: docker-build
docker-build: docker-rmi-for-build
docker build \
--tag $(DOCKER_IMAGE_NAME) \
--tag $(DOCKER_IMAGE_NAME):$(GIT_VERSION) \
.
.PHONY: docker-build-development-cache
docker-build-development-cache: docker-rmi-for-build-development-cache
docker build \
--tag $(DOCKER_IMAGE_TAG) \
.
# -----------------------------------------------------------------------------
# Clean up targets
# -----------------------------------------------------------------------------
.PHONY: docker-rmi-for-build
docker-rmi-for-build:
-docker rmi --force \
$(DOCKER_IMAGE_NAME):$(GIT_VERSION) \
$(DOCKER_IMAGE_NAME)
.PHONY: docker-rmi-for-build-development-cache
docker-rmi-for-build-development-cache:
-docker rmi --force $(DOCKER_IMAGE_TAG)
.PHONY: clean
clean: docker-rmi-for-build docker-rmi-for-build-development-cache
# -----------------------------------------------------------------------------
# Help
# -----------------------------------------------------------------------------
.PHONY: help
help:
@echo "List of make targets:"
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs