isle/release.sh
2023-03-25 15:58:20 +01:00

35 lines
657 B
Bash
Executable File

#!/usr/bin/env sh
set -e
scriptDir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)
cd "$scriptDir"
printf "Release name (e.g. \"v0.1.2\"): "
read -r releaseName
releasesDir="$(pwd)/releases"
mkdir -p "$releasesDir"
echo '*' > "$releasesDir"/.gitignore
out="$releasesDir/$releaseName"
if [ -e "$out" ]; then
echo "$out already exists, aborting"
exit 1
fi
result=$(nix-build \
--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"