#!/bin/sh # Build the gateway for every supported platform and sign a release manifest. # # The signing key is read from a file and never leaves this machine; the artifacts and the signed # manifest are what get published. Usage: # # NOSTRINO_RELEASE_KEY=~/.config/nostrino/release.key \ # ./scripts/build-release.sh 0.3.0 https://downloads.example/nostrino # set -eu VERSION=${1:?usage: build-release.sh } BASE=${2:?usage: build-release.sh } KEY=${NOSTRINO_RELEASE_KEY:?set NOSTRINO_RELEASE_KEY to the Ed25519 private key file} OUT=${OUT:-dist} rm -rf "$OUT" mkdir -p "$OUT" for platform in linux/amd64 linux/arm64; do os=${platform%%/*} arch=${platform##*/} echo "building $os/$arch" CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -trimpath \ -ldflags "-s -w -X main.version=$VERSION" \ -o "$OUT/nostrino-gateway-$VERSION-$os-$arch" ./cmd/nostrino-bridge # The operator CLI is shipped beside the gateway: a gateway that updates itself is only # useful if the operator has a way to send the command, and asking an operator to install a # Go toolchain on a Start9 box to do it is not a way. It is not in the manifest (the gateway # is the only thing that installs itself); the release notes name its digest. CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -trimpath \ -ldflags "-s -w -X main.version=$VERSION" \ -o "$OUT/nostrino-admin-$VERSION-$os-$arch" ./cmd/nostrino-admin done echo "signing manifest" go run ./cmd/nostrino-release \ -artifacts "$OUT" -version "$VERSION" -key "$(cat "$KEY")" \ -base-url "$BASE" -out "$OUT/manifest.json" ${NOTES:+-notes "$NOTES"} echo "release $VERSION is in $OUT" ls -l "$OUT"