mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-07 21:19:51 +00:00
Resolved the issue where the final deployment logs for the domain were not recorded after immediate execution.
This commit is contained in:
parent
f6760515e9
commit
bbc6d094c3
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@ vendor
|
||||
pb_data
|
||||
main
|
||||
certimate
|
||||
build
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
|
37
Makefile
Normal file
37
Makefile
Normal file
@ -0,0 +1,37 @@
|
||||
# 定义变量
|
||||
BINARY_NAME=certimate
|
||||
VERSION=$(shell git describe --tags --always)
|
||||
BUILD_DIR=build
|
||||
|
||||
# 支持的操作系统和架构列表
|
||||
OS_ARCH=\
|
||||
linux/amd64 \
|
||||
linux/arm64 \
|
||||
darwin/amd64 \
|
||||
darwin/arm64 \
|
||||
windows/amd64 \
|
||||
windows/arm64
|
||||
|
||||
# 默认目标
|
||||
all: build
|
||||
|
||||
# 构建所有平台的二进制文件
|
||||
build: $(OS_ARCH)
|
||||
$(OS_ARCH):
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
GOOS=$(word 1,$(subst /, ,$@)) \
|
||||
GOARCH=$(word 2,$(subst /, ,$@)) \
|
||||
go build -o $(BUILD_DIR)/$(BINARY_NAME)_$(word 1,$(subst /, ,$@))_$(word 2,$(subst /, ,$@)) -ldflags="-X main.version=$(VERSION)" .
|
||||
|
||||
# 清理构建文件
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
# 帮助信息
|
||||
help:
|
||||
@echo "Usage:"
|
||||
@echo " make - 编译所有平台的二进制文件"
|
||||
@echo " make clean - 清理构建文件"
|
||||
@echo " make help - 显示此帮助信息"
|
||||
|
||||
.PHONY: all build clean help
|
@ -14,9 +14,7 @@ func create(ctx context.Context, record *models.Record) error {
|
||||
}
|
||||
|
||||
if record.GetBool("rightnow") {
|
||||
defer func() {
|
||||
setRightnow(ctx, record, false)
|
||||
}()
|
||||
|
||||
if err := deploy(ctx, record); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -46,9 +44,7 @@ func update(ctx context.Context, record *models.Record) error {
|
||||
}
|
||||
|
||||
if record.GetBool("rightnow") {
|
||||
defer func() {
|
||||
setRightnow(ctx, record, false)
|
||||
}()
|
||||
|
||||
if err := deploy(ctx, record); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ func (a *history) commit() error {
|
||||
|
||||
domainRecord.Set("lastDeployedAt", a.DeployedAt)
|
||||
domainRecord.Set("lastDeployment", record.Id)
|
||||
domainRecord.Set("rightnow", false)
|
||||
|
||||
if err := app.GetApp().Dao().SaveRecord(domainRecord); err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user