Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 077816d

Browse files
author
noah
committed
Add the script for building cli
1 parent ad80e06 commit 077816d

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@
1515
# Dependency directories (remove the comment below to include it)
1616
# vendor/
1717
.env
18-
*.db
18+
*.db
19+
20+
release/

scripts/build-cli.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
set -e
3+
set -x
4+
5+
# disable CGO for cross-compiling
6+
export CGO_ENABLED=0
7+
8+
# compile for all architectures
9+
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=${GITHUB_REF_NAME##v}" -o release/linux/amd64/gitploy ./cmd/cli
10+
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.Version=${GITHUB_REF_NAME##v}" -o release/linux/arm64/gitploy ./cmd/cli
11+
GOOS=linux GOARCH=ppc64le go build -ldflags "-X main.Version=${GITHUB_REF_NAME##v}" -o release/linux/ppc64le/gitploy ./cmd/cli
12+
GOOS=linux GOARCH=arm go build -ldflags "-X main.Version=${GITHUB_REF_NAME##v}" -o release/linux/arm/gitploy ./cmd/cli
13+
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.Version=${GITHUB_REF_NAME##v}" -o release/windows/amd64/gitploy.exe ./cmd/cli
14+
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.Version=${GITHUB_REF_NAME##v}" -o release/darwin/amd64/gitploy ./cmd/cli
15+
GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.Version=${GITHUB_REF_NAME##v}" -o release/darwin/arm64/gitploy ./cmd/cli
16+
17+
# tar binary files prior to upload
18+
tar -cvzf release/gitploy_linux_amd64.tar.gz -C release/linux/amd64 gitploy
19+
tar -cvzf release/gitploy_linux_arm64.tar.gz -C release/linux/arm64 gitploy
20+
tar -cvzf release/gitploy_linux_ppc64le.tar.gz -C release/linux/ppc64le gitploy
21+
tar -cvzf release/gitploy_linux_arm.tar.gz -C release/linux/arm gitploy
22+
tar -cvzf release/gitploy_windows_amd64.tar.gz -C release/windows/amd64 gitploy.exe
23+
tar -cvzf release/gitploy_darwin_amd64.tar.gz -C release/darwin/amd64 gitploy
24+
tar -cvzf release/gitploy_darwin_arm64.tar.gz -C release/darwin/arm64 gitploy
25+
26+
# generate shas for tar files
27+
sha256sum release/*.tar.gz > release/gitploy_checksums.txt

0 commit comments

Comments
 (0)