💚 ci: Update .gitignore and add makefile for building the project

This commit is contained in:
Martial BE 2024-03-25 11:21:24 +08:00
parent 48efdbc7df
commit 2305da2359
No known key found for this signature in database
GPG Key ID: D06C32DF0EDB9084
2 changed files with 20 additions and 2 deletions

4
.gitignore vendored
View File

@ -10,6 +10,6 @@ data
tmp/
/test/
.env
common/plugin/
common/balancer/
config.yaml
config.yaml
dist

18
makefile Normal file
View File

@ -0,0 +1,18 @@
NAME=one-api
DISTDIR=dist
WEBDIR=web
VERSION=$(shell git describe --tags || echo "dev")
GOBUILD=go build -ldflags "-s -w -X 'one-api/common.Version=$(VERSION)'"
all: one-api
web: $(WEBDIR)/build
$(WEBDIR)/build:
cd $(WEBDIR) && npm install && REACT_APP_VERSION=$(VERSION) npm run build
one-api: web
$(GOBUILD) -o $(DISTDIR)/$(NAME)
clean:
rm -rf $(DISTDIR) && rm -rf $(WEBDIR)/build