isle/release.sh

40 lines
776 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 \"0.1.2\" [build number]"
exit 1
fi
buildNumber="$2"
if [ -z "$buildNumber" ]; then
buildNumber="0"
fi
releasesDir="$(pwd)/releases"
mkdir -p "$releasesDir"
echo '*' > "$releasesDir"/.gitignore
out="$releasesDir/$releaseName-$buildNumber"
rm -rf "$out"
result=$(nix-build -v \
--argstr releaseName "$releaseName" \
--argstr buildNumber "$buildNumber" \
--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"