-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
105 lines (90 loc) · 2.97 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
.PHONY: container_build container_shell build server clean distclean client github_client github_server loregen versiongen update
ARTIFACTS=$(shell pwd)/artifacts
ifndef VIRTUAL_ENV
CIENV = $(shell pwd)/.venv/bin/
else
CIENV = $(VIRTUAL_ENV)/bin/
endif
DOCKER_IMAGE="ghcr.io/tribesthatmaybe/workflow"
versiongen:
docker run -v "$(shell pwd):/mnt" \
otakup0pe/avakas show /mnt \
2> /dev/null 1> "$(shell pwd)/.version"
cut -f 1 -d '+' < "$(shell pwd)/.version" > "$(shell pwd)/.version-container"
container_build: versiongen
mkdir -p deps
ifdef PACKMAKER
rm -rf deps/packmaker && \
cp -r $(PACKMAKER) deps/packmaker && \
rm -rf deps/packmaker/.git
else
rm -rf deps/packmaker
endif
docker build \
--tag $(DOCKER_IMAGE):$(shell cat $(shell pwd)/.version-container) \
.
container_shell: container_build
docker run \
-it --rm \
-v "$(shell pwd):/mnt" \
-u "$(shell id -u):$(shell id -g)" \
$(DOCKER_IMAGE):$(shell cat $(shell pwd)/.version-container) \
shell
update: container_build
docker run \
--rm \
-v "$(shell pwd):/mnt" \
-u "$(shell id -u):$(shell id -g)" \
$(DOCKER_IMAGE):$(shell cat $(shell pwd)/.version-container) \
update
lock: container_build
docker run \
--rm \
-v "$(shell pwd):/mnt" \
-u "$(shell id -u):$(shell id -g)" \
$(DOCKER_IMAGE):$(shell cat $(shell pwd)/.version-container) \
lock
client: container_build versiongen loregen
rm -rf build/curseforge
docker run \
--rm \
-v "$(shell pwd):/mnt" \
-u "$(shell id -u):$(shell id -g)" \
$(DOCKER_IMAGE):$(shell cat $(shell pwd)/.version-container) \
build
mkdir -p artifacts
VERSION=$$(cat $(shell pwd)/.version) ; \
cp build/release/ttmb-$${VERSION}.zip $(ARTIFACTS)/ttmb-client-$${VERSION}.zip
server: container_build versiongen loregen
rm -f build/server/mods/* $(ARTIFACTS)/ttmb-server-$(VERSION).zip
docker run \
--rm \
-v "$(shell pwd):/mnt" \
-u "$(shell id -u):$(shell id -g)" \
$(DOCKER_IMAGE):$(shell cat $(shell pwd)/.version-container) \
server
mkdir -p artifacts
VERSION=$$(cat $(shell pwd)/.version) ; \
cd build/server && zip -r $(ARTIFACTS)/ttmb-server-$${VERSION}.zip *
build: client server
clean:
rm -rf build/server build/release .version .version-container
rm -f src/config/loreexpansion/lore/*.json src/structures/active/lore_*.rcig
distclean: clean
rm -rf build curseforge.db packmaker.lock config.yml .venv
github_client: client
mkdir -p artifacts/github/client
VERSION=$$(cat $(shell pwd)/.version) ; \
cd $(ARTIFACTS)/github/client && unzip $(ARTIFACTS)/ttmb-client-$${VERSION}.zip
github_server: server
mkdir -p artifacts/github/server
VERSION=$$(cat $(shell pwd)/.version) ; \
cd $(ARTIFACTS)/github/server && unzip $(ARTIFACTS)/ttmb-server-$${VERSION}.zip
loregen: container_build
rm -rf src/config/loreexpansion/lore/*.json src/structures/active/lore_*.rcig
cp lore/static/*.json src/config/loreexpansion/lore/
docker run \
--rm \
-v "$(shell pwd):/mnt" \
$(DOCKER_IMAGE):$(shell cat $(shell pwd)/.version-container) \
loregen