Skip to content

Commit ce0219d

Browse files
authored
chore: update the release config for static build (#173)
Signed-off-by: chlins <[email protected]>
1 parent d71790c commit ce0219d

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
tags:
66
- v*
77

8-
permissions:
8+
permissions:
99
contents: read
1010

1111
jobs:
@@ -28,6 +28,24 @@ jobs:
2828
with:
2929
go-version-file: go.mod
3030

31+
- name: Install dependencies
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install -y pkg-config
35+
sudo apt update && \
36+
sudo DEBIAN_FRONTEND=noninteractive apt install -y build-essential cmake pkg-config libssl-dev libssh2-1-dev zlib1g-dev libhttp-parser-dev python3 wget tar git && \
37+
wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.5.1.tar.gz -O libgit2-v1.5.1.tar.gz && \
38+
tar -xzf libgit2-v1.5.1.tar.gz && \
39+
cd libgit2-1.5.1 && \
40+
mkdir build && \
41+
cd build && \
42+
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && \
43+
make -j$(nproc) && \
44+
sudo make install && \
45+
sudo ldconfig
46+
env:
47+
LIBGIT2_SYS_USE_PKG_CONFIG: "1"
48+
3149
- name: Check GoReleaser config
3250
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552
3351
with:

.goreleaser.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ builds:
1717
- amd64
1818
- arm64
1919
env:
20-
- CGO_ENABLED=0
20+
- CGO_ENABLED=1
2121
ldflags:
2222
- -X github.com/CloudNativeAI/modctl/pkg/version.GitVersion={{ .Tag }}
2323
- -X github.com/CloudNativeAI/modctl/pkg/version.GitCommit={{ .ShortCommit }}
2424
- -X github.com/CloudNativeAI/modctl/pkg/version.BuildTime={{ .Date }}
25+
- -extldflags "-static"
26+
tags:
27+
- static
28+
- system_libgit2
2529

2630
archives:
2731
- name_template: "modctl-{{ .Version }}-{{ .Os }}-{{ .Arch }}"

0 commit comments

Comments
 (0)