Skip to content

Commit

Permalink
交叉编译
Browse files Browse the repository at this point in the history
  • Loading branch information
wandercn committed Jul 6, 2021
1 parent bcd1fe2 commit ef95d58
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
25 changes: 25 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
lastTag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo $lastTag > version.txt
# Linux
GO_ENABLED=0 GOOS=linux GOARCH=amd64
target="hotbuild_${lastTag}_${GOOS}_${GOARCH}"
go build -ldflags="-X 'main.Version=$lastTag'" -o ./build/$target/
cd build/
zip -mr $target.zip $target
cd ..
# macosx
GO_ENABLED=0 GOOS=darwin GOARCH=amd64
target="hotbuild_${lastTag}_${GOOS}_${GOARCH}"
go build -ldflags="-X 'main.Version=$lastTag'" -o ./build/$target/
cd build/
zip -mr $target.zip $target
cd ..
# windows
GO_ENABLED=0 GOOS=windows GOARCH=amd64
target="hotbuild_${lastTag}_${GOOS}_${GOARCH}"
go build -ldflags="-X 'main.Version=$lastTag'" -o ./build/$target/
cd build/
zip -mr $target.zip $target
cd ..

4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Author : wander
# Email : [email protected]
# File Name : main.go
# Last Modified : 2021-07-03 08:08
# Last Modified : 2021-07-06 15:18
# Describe :
#
# ====================================================*/
Expand All @@ -24,6 +24,6 @@ func main() {
| _ | |_| || | | |_) | |_| || || |___| |_| |
|_| |_|\___/ |_| |____/ \___/|___|_____|____/ %s, built with Go %s
`, hotbuildVersion, goVersion)
`, Version, goVersion)
watch.Start()
}
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v1.0.3

0 comments on commit ef95d58

Please sign in to comment.