Skip to content

Commit

Permalink
added silly build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Marchelli committed Aug 4, 2022
1 parent 9b7bdb5 commit 40dcc87
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
build
.idea
.vscode
bin/*
23 changes: 23 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

D=$(basename "${PWD}")

name=${1:-$D}
mkdir -p bin

read -r h m s <<< "$(date "+%H %M %S")"
minor=$(( (h + 1) * (m + 1) * (${s#0} + 1) ))
major=$(date +%Y%m%d)
version="${major}.${minor}"

oses=( linux darwin )
archs=( amd64 arm64 )

for GOOS in "${oses[@]}";do
for GOARCH in "${archs[@]}"; do
echo "Building ${GOARCH} for ${GOOS}..."
GOOS=${GOOS} GOARCH=${GOARCH} CGO_ENABLED=0 \
go build -ldflags "-s -w -X 'main.Version=v${version}'" \
-o "bin/${name}-${GOOS}-${GOARCH}" .
done
done

0 comments on commit 40dcc87

Please sign in to comment.