Skip to content

Commit 87fdc59

Browse files
feat: add CI for binary release
Signed-off-by: zufar.dhiyaulhaq <zufardhiyaulhaq@gmail.com>
1 parent 818dcab commit 87fdc59

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ jobs:
4444
with:
4545
go-version: '1.21'
4646

47+
- name: Download dependencies
48+
run: go mod download
49+
4750
- name: Build binary
4851
env:
4952
GOOS: ${{ matrix.goos }}
5053
GOARCH: ${{ matrix.goarch }}
54+
CGO_ENABLED: 0
5155
run: |
5256
mkdir -p dist
53-
go build -o dist/safekubectl-${GOOS}-${GOARCH} ./cmd/safekubectl/
57+
go build -o dist/safekubectl-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/safekubectl
5458
5559
- name: Upload artifact
5660
uses: actions/upload-artifact@v4

.github/workflows/release.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
with:
4444
go-version: '1.21'
4545

46+
- name: Download dependencies
47+
run: go mod download
48+
4649
- name: Get version from tag
4750
id: version
4851
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
@@ -52,16 +55,16 @@ jobs:
5255
mkdir -p dist
5356
5457
# Linux amd64
55-
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${{ steps.version.outputs.VERSION }}" -o dist/safekubectl-linux-amd64 ./cmd/safekubectl/
58+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${{ steps.version.outputs.VERSION }}" -o dist/safekubectl-linux-amd64 ./cmd/safekubectl
5659
5760
# Linux arm64
58-
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${{ steps.version.outputs.VERSION }}" -o dist/safekubectl-linux-arm64 ./cmd/safekubectl/
61+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${{ steps.version.outputs.VERSION }}" -o dist/safekubectl-linux-arm64 ./cmd/safekubectl
5962
6063
# macOS amd64
61-
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${{ steps.version.outputs.VERSION }}" -o dist/safekubectl-darwin-amd64 ./cmd/safekubectl/
64+
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${{ steps.version.outputs.VERSION }}" -o dist/safekubectl-darwin-amd64 ./cmd/safekubectl
6265
6366
# macOS arm64 (Apple Silicon)
64-
GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.version=${{ steps.version.outputs.VERSION }}" -o dist/safekubectl-darwin-arm64 ./cmd/safekubectl/
67+
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.version=${{ steps.version.outputs.VERSION }}" -o dist/safekubectl-darwin-arm64 ./cmd/safekubectl
6568
6669
- name: Create archives
6770
run: |

0 commit comments

Comments
 (0)