Skip to content

Commit

Permalink
Add compile and realese scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
evildecay committed Sep 5, 2024
1 parent 7f4baeb commit e8c389f
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _test
.idea
pkg
bin
release
*.tmp

# Architecture specific extensions/prefixes
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ Usage of D:\Applications\etcdkeeper\etcdkeeper.exe:
## Special Note
Because the etcdv3 version uses the new storage concept, without the catalog concept, the client uses the previous default "/" delimiter to view. See the documentation for etcdv3 [clientv3 doc](https://godoc.org/github.com/coreos/etcd/clientv3).

## Compile source code and release
* Run in Windows development environment: `build.bat` `release.bat`
* Run in Posix development environment: `build.sh` `release.sh`

## Docker
Etdkeeper official image. (https://hub.docker.com/r/evildecay/etcdkeeper)

Expand Down
35 changes: 35 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@echo off

if "%OS%" == "Windows_NT" (
setlocal enabledelayedexpansion
)

cd src\etcdkeeper

REM Windows amd64
set GOOS=windows
set GOARCH=amd64
go install
echo build etcdkeeper GOOS=windows GOARCH=amd64 ok

REM Linux amd64
set GOOS=linux
set GOARCH=amd64
go install
echo build etcdkeeper GOOS=linux GOARCH=amd64 ok

REM Darwin amd64
set GOOS=darwin
set GOARCH=amd64
go install
echo build etcdkeeper GOOS=darwin GOARCH=amd64 ok

REM Linux arm64
set GOOS=linux
set GOARCH=arm64
go install
echo build etcdkeeper GOOS=linux GOARCH=arm64 ok

cd ..\..

endlocal
29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

cd src/etcdkeeper || echo Need to cd to the src/etcdkeeper directory first.

# Windows amd64
export GOOS=windows
export GOARCH=amd64
go install
echo build etcdkeeper GOOS=windows GOARCH=amd64 ok

# Linux amd64
export GOOS=linux
export GOARCH=amd64
go install
echo build etcdkeeper GOOS=linux GOARCH=amd64 ok

# Darwin amd64
export GOOS=darwin
export GOARCH=amd64
go install
echo build etcdkeeper GOOS=darwin GOARCH=amd64 ok

# Linux arm64
export GOOS=linux
export GOARCH=arm64
go install
echo build etcdkeeper GOOS=linux GOARCH=arm64 ok

cd ../..
40 changes: 40 additions & 0 deletions release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@echo off

if "%OS%" == "Windows_NT" (
setlocal enabledelayedexpansion
)

set ver=%1

if "%ver%" == "" (
echo Release version is empty.
goto quit
)

REM Windows amd64
echo release etcdkeeper-v%ver%-windows_x86_64.zip
tar -cf release\etcdkeeper-v%ver%-windows_x86_64.zip --strip-components 1 bin\etcdkeeper.exe
tar -rf release\etcdkeeper-v%ver%-windows_x86_64.zip assets
tar -rf release\etcdkeeper-v%ver%-windows_x86_64.zip LICENSE README.md

REM Linux amd64
echo release etcdkeeper-v%ver%-linux_x86_64.zip
tar -cf release\etcdkeeper-v%ver%-linux_x86_64.zip --strip-components 2 bin\linux_amd64\etcdkeeper
tar -rf release\etcdkeeper-v%ver%-linux_x86_64.zip assets
tar -rf release\etcdkeeper-v%ver%-linux_x86_64.zip LICENSE README.md

REM Darwin amd64
echo release etcdkeeper-v%ver%-darwin_x86_64.zip
tar -cf release\etcdkeeper-v%ver%-darwin_x86_64.zip --strip-components 2 bin\darwin_amd64\etcdkeeper
tar -rf release\etcdkeeper-v%ver%-darwin_x86_64.zip assets
tar -rf release\etcdkeeper-v%ver%-darwin_x86_64.zip LICENSE README.md

REM Linux arm64
echo release etcdkeeper-v%ver%-linux_arm64.zip
tar -cf release\etcdkeeper-v%ver%-linux_arm64.zip --strip-components 2 bin\linux_arm64\etcdkeeper
tar -rf release\etcdkeeper-v%ver%-linux_arm64.zip assets
tar -rf release\etcdkeeper-v%ver%-linux_arm64.zip LICENSE README.md

:quit

endlocal
32 changes: 32 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

ver=$1

if [ "ver" = "" ]; then
echo Release version is empty.
exit
fi

# Windows amd64
echo release etcdkeeper-v%ver%-windows_x86_64.zip
tar -cf release\etcdkeeper-v%ver%-windows_x86_64.zip --strip-components 1 bin\etcdkeeper.exe
tar -rf release\etcdkeeper-v%ver%-windows_x86_64.zip assets
tar -rf release\etcdkeeper-v%ver%-windows_x86_64.zip LICENSE README.md

# Linux amd64
echo release etcdkeeper-v%ver%-linux_x86_64.zip
tar -cf release\etcdkeeper-v%ver%-linux_x86_64.zip --strip-components 2 bin\linux_amd64\etcdkeeper
tar -rf release\etcdkeeper-v%ver%-linux_x86_64.zip assets
tar -rf release\etcdkeeper-v%ver%-linux_x86_64.zip LICENSE README.md

# Darwin amd64
echo release etcdkeeper-v%ver%-darwin_x86_64.zip
tar -cf release\etcdkeeper-v%ver%-darwin_x86_64.zip --strip-components 2 bin\darwin_amd64\etcdkeeper
tar -rf release\etcdkeeper-v%ver%-darwin_x86_64.zip assets
tar -rf release\etcdkeeper-v%ver%-darwin_x86_64.zip LICENSE README.md

# Linux arm64
echo release etcdkeeper-v%ver%-linux_arm64.zip
tar -cf release\etcdkeeper-v%ver%-linux_arm64.zip --strip-components 2 bin\linux_arm64\etcdkeeper
tar -rf release\etcdkeeper-v%ver%-linux_arm64.zip assets
tar -rf release\etcdkeeper-v%ver%-linux_arm64.zip LICENSE README.md

0 comments on commit e8c389f

Please sign in to comment.