This commit is contained in:
xinian
2026-01-27 23:10:41 +08:00
parent fc55a237ed
commit 830d264757

View File

@@ -19,6 +19,16 @@ main:
- VERSION="v$(git rev-parse --short=8 HEAD)"
- echo "BUILD_VERSION=${VERSION}"
# ========== 缓存Go依赖 ==========
- name: cache go modules
image: meltwater/drone-cache:latest
settings:
restore: true
mount:
- /go/pkg/mod
- /root/.cache/go-build
cache_key: '{{ .Repo.Name }}-{{ .Commit.Branch }}-{{ checksum "go.mod" }}'
# ========== 编译Logic服务 ==========
- name: build logic
image: golang:1.25
@@ -29,8 +39,19 @@ main:
commands:
- mkdir -p build
- BIN_NAME="logic_${BUILD_VERSION}"
- go mod download -x
- go build -v -p=4 -trimpath -buildvcs=false -ldflags "-s -w -buildid= -extldflags '-static'" -o ./build/${BIN_NAME} ./logic
- ls -lh ./build/
# ========== 重建缓存 ==========
- name: rebuild cache
image: meltwater/drone-cache:latest
settings:
rebuild: true
mount:
- /go/pkg/mod
- /root/.cache/go-build
cache_key: '{{ .Repo.Name }}-{{ .Commit.Branch }}-{{ checksum "go.mod" }}'
# ========== 拉取部署配置 ==========
- name: fetch deploy config