소스 검색

Add task for static build

tags/v2.1.8^2
9seconds 6 달 전
부모
커밋
75c317f35e
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 16
    0
      .mise.toml

+ 16
- 0
.mise.toml 파일 보기

@@ -8,6 +8,22 @@ sources = ["**/*.go", "go.mod", "go.sum"]
8 8
 outputs = ["mtg"]
9 9
 run = "go build"
10 10
 
11
+[tasks.static]
12
+description = "Build static binary"
13
+sources = ["**/*.go", "go.mod", "go.sum"]
14
+outputs = ["mtg"]
15
+run = """
16
+#!/bin/bash
17
+
18
+version="$(git describe --exact-match HEAD 2>/dev/null || git describe --tags --always)"
19
+go build \
20
+    -trimpath \
21
+    -mod=readonly \
22
+    -ldflags="-extldflags '-static' -s -w -X 'main.version=$version'" \
23
+    -a \
24
+    -tags netgo
25
+"""
26
+
11 27
 [tasks.release]
12 28
 description = "Create release tarballs"
13 29
 tools.goreleaser = "latest"

Loading…
취소
저장