mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
release.sh: check Go version, provide GO_CMD var
This commit is contained in:
parent
6d8872f995
commit
260b90d1af
2 changed files with 40 additions and 2 deletions
|
|
@ -58,6 +58,25 @@ other tools:
|
|||
sudo apt-get install build-essential git make zip perl gpg
|
||||
```
|
||||
|
||||
You can [download](https://go.dev/dl/) and unpack Go somewhere and set variable
|
||||
`GO_CMD=/path/to/go` (path to Go binary of the needed version).
|
||||
|
||||
If you already have another Go version, you can install the Go version needed
|
||||
for a release using the following commands:
|
||||
|
||||
```bash
|
||||
$ go version
|
||||
go version go1.25.0 linux/amd64
|
||||
$ go install golang.org/dl/go1.24.6@latest
|
||||
$ go1.24.6 download
|
||||
Unpacking /home/user/sdk/go1.24.6/go1.24.6.linux-amd64.tar.gz ...
|
||||
Success. You may now run 'go1.24.6'
|
||||
$ go1.24.6 version
|
||||
go version go1.24.6 linux/amd64
|
||||
|
||||
$ GO_CMD=/home/user/go/bin/go1.24.6 ./release.sh v0.31.3
|
||||
```
|
||||
|
||||
On MacOS, you will need to install GNU tar and GNU gzip, which can be done with
|
||||
`brew`:
|
||||
|
||||
|
|
|
|||
23
release.sh
23
release.sh
|
|
@ -27,6 +27,25 @@ function red() {
|
|||
echo -e "\e[0;31m${1}\e[0m"
|
||||
}
|
||||
|
||||
# Use GO_CMD from env if set, otherwise default to "go".
|
||||
GO_CMD="${GO_CMD:-go}"
|
||||
|
||||
# Check if the command exists.
|
||||
if ! command -v "$GO_CMD" >/dev/null 2>&1; then
|
||||
red "Error: Go command '$GO_CMD' not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure we have the expected Go version installed.
|
||||
EXPECTED_VERSION="go1.24.6"
|
||||
INSTALLED_VERSION=$("$GO_CMD" version 2>/dev/null | awk '{print $3}')
|
||||
if [ "$INSTALLED_VERSION" = "$EXPECTED_VERSION" ]; then
|
||||
green "Go version matches expected: $INSTALLED_VERSION"
|
||||
else
|
||||
red "Error: Expected Go version $EXPECTED_VERSION but found $INSTALLED_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TAG=''
|
||||
|
||||
check_tag() {
|
||||
|
|
@ -203,7 +222,7 @@ fi
|
|||
green " - Creating artifacts directory ${ARTIFACTS_DIR}"
|
||||
mkdir -p "$ARTIFACTS_DIR"
|
||||
green " - Packaging vendor to ${ARTIFACTS_DIR}/vendor.tar.gz"
|
||||
go mod vendor
|
||||
"$GO_CMD" mod vendor
|
||||
reproducible_tar_gzip vendor "${ARTIFACTS_DIR}/vendor.tar.gz"
|
||||
rm -r vendor
|
||||
|
||||
|
|
@ -248,7 +267,7 @@ for i in $SYS; do
|
|||
|
||||
green "- Building: $OS $ARCH $ARM"
|
||||
for bin in loop loopd; do
|
||||
env CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH GOARM=$ARM go build -v -trimpath -ldflags "$COMMITFLAGS" "github.com/lightninglabs/loop/cmd/$bin"
|
||||
env CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH GOARM=$ARM "$GO_CMD" build -v -trimpath -ldflags "$COMMITFLAGS" "github.com/lightninglabs/loop/cmd/$bin"
|
||||
done
|
||||
cd ..
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue