forked from authcrunch/authcrunch.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (45 loc) · 1.49 KB
/
Copy pathMakefile
File metadata and controls
51 lines (45 loc) · 1.49 KB
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
PROJECT_NAME="authcrunch-docs"
PROJECT_VERSION:=$(shell cat VERSION | head -1)
GIT_COMMIT:=$(shell git describe --dirty --always)
GIT_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD -- | head -1)
LATEST_GIT_COMMIT:=$(shell git log --format="%H" -n 1 | head -1)
BUILD_USER:=$(shell whoami)
BUILD_DATE:=$(shell date +"%Y-%m-%d")
BUILD_DIR:=$(shell pwd)
all: info build
@echo "$@: complete"
.PHONY: info
info:
@versioned --sync package.json
@echo "DEBUG: $(PROJECT_NAME) Version: $(PROJECT_VERSION), Branch: $(GIT_BRANCH), Revision: $(GIT_COMMIT)"
@echo "DEBUG: Build on $(BUILD_DATE) by $(BUILD_USER)"
.PHONY: build
build:
@echo "$@: started"
@echo "$@: complete"
.PHONE: clean
clean:
@echo "$@: started"
@echo "$@: complete"
.PHONE: test
test: clean
@echo "$@: started"
@echo "$@: complete"
.PHONY: release
release:
@echo "$@: started"
@versioned --sync package.json
@if [ $(GIT_BRANCH) != "main" ]; then echo "cannot release to non-main branch $(GIT_BRANCH)" && false; fi
@git diff-index --quiet HEAD -- || ( echo "git directory is dirty, commit changes first" && false )
@versioned -patch
@versioned --sync package.json
@echo "Patched version"
@git add VERSION package.json
@git commit -m "released v`cat VERSION | head -1`"
@git tag -a v`cat VERSION | head -1` -m "v`cat VERSION | head -1`"
@git push
@git push --tags
@@echo "If necessary, run the following commands:"
@echo " git push --delete origin v$(PROJECT_VERSION)"
@echo " git tag --delete v$(PROJECT_VERSION)"
@echo "$@: complete"