Skip to content

Commit 24ff82b

Browse files
committed
chore: update make script
1 parent 207f968 commit 24ff82b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
/bin
1010
/target
1111
/build
12+
/ddns
13+
*.tar.gz
1214

1315
# Test binary, built with `go test -c`
1416
*.test

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,23 @@ help: ## show help
1616

1717
LD_FLAGS=-ldflags "-X ddns/pkg/config.Version=$(VERSION)"
1818

19-
build: ## build target
19+
clean: ## clean build target
20+
21+
rm -fr $(TARGET_PATH)
22+
rm -f *.tar.gz
23+
24+
build: clean ## build target
2025

2126
mkdir -p $(TARGET_PATH) $(TARGET_PATH)/bin $(TARGET_PATH)/conf $(TARGET_PATH)/log
2227
go build $(LD_FLAGS) -o $(TARGET_PATH)/bin/$(SERVICE_NAME) cmd/$(SERVICE_NAME).go
2328
cp configs/template.yml $(TARGET_PATH)/conf
29+
cp configs/ddns.service $(TARGET_PATH)/conf
30+
31+
tag: build ## make tgz package
32+
33+
cp -r $(TARGET_PATH) $(SERVICE_NAME)
34+
tar zcvf $(SERVICE_NAME).$(VERSION).tar.gz $(SERVICE_NAME)
35+
rm -fr $(SERVICE_NAME)
2436

2537
docker: build ## build docker
2638

@@ -38,7 +50,7 @@ pull: ## pull latest published docker
3850

3951
docker pull $(DOCKER_REPO)/$(SERVICE_NAME):latest
4052

41-
install: build ## install by systemd
53+
install: ## install by systemd
4254

4355
cp $(TARGET_PATH)/bin/$(SERVICE_NAME) /usr/local/bin/
4456
cp configs/ddns.service /etc/systemd/system/

0 commit comments

Comments
 (0)