isle/release.sh

36 lines
689 B
Bash
Executable File

#!/usr/bin/env sh
set -e
scriptDir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)
cd "$scriptDir"
releaseName="$1"
if [ -z "$releaseName" ]; then
echo "USAGE: $0 \"v0.1.2\""
exit 1
fi
releasesDir="$(pwd)/releases"
mkdir -p "$releasesDir"
echo '*' > "$releasesDir"/.gitignore
out="$releasesDir/$releaseName"
revision=$(git rev-parse HEAD)
result=$(nix-build -v \
--argstr revision "$revision" \
--argstr releaseName "$releaseName" \
--no-out-link \
release.nix \
)
cp -rL "$result" "$out"
chmod u+w -R "$out"
cd "$out"
gpg -a --detach-sign -o sha256.txt.gpg ./sha256.txt
echo "Release successfully created: $out"