mirror of
https://github.com/DeterminateSystems/nix-installer-action.git
synced 2024-12-23 13:32:06 +01:00
Fix comparison script
This commit is contained in:
parent
164c9d00dc
commit
481524661c
1 changed files with 11 additions and 6 deletions
17
.github/verify-version.sh
vendored
17
.github/verify-version.sh
vendored
|
@ -1,13 +1,18 @@
|
||||||
#!/usr/bin/env
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script verifies that the version of Nix installed on the runner
|
||||||
|
# matches the version supplied in the first argument.
|
||||||
|
|
||||||
EXPECTED_VERSION="${1}"
|
EXPECTED_VERSION="${1}"
|
||||||
|
|
||||||
NIX_VERSION_OUTPUT=$(nix --version)
|
INSTALLED_NIX_VERSION_OUTPUT=$(nix --version)
|
||||||
NIX_VERSION=$(echo "${NIX_VERSION_OUTPUT}" | awk '{print $NF}')
|
INSTALLED_NIX_VERSION=$(echo "${INSTALLED_NIX_VERSION_OUTPUT}" | awk '{print $NF}')
|
||||||
EXPECTED_OUTPUT="nix (Nix) ${EXPECTED_VERSION}"
|
EXPECTED_OUTPUT="nix (Nix) ${EXPECTED_VERSION}"
|
||||||
if [ "${NIX_VERSION_OUTPUT}" != "${EXPECTED_OUTPUT}" ]; then
|
|
||||||
echo "Nix version ${NIX_VERSION} didn't match expected version ${EXPECTED_VERSION}"
|
if [ "${INSTALLED_NIX_VERSION_OUTPUT}" != "${EXPECTED_OUTPUT}" ]; then
|
||||||
|
echo "Nix version ${INSTALLED_NIX_VERSION} didn't match expected version ${EXPECTED_VERSION}"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Success! Nix version ${NIX_VERSION} installed as expected"
|
echo "Success! Nix version ${INSTALLED_NIX_VERSION} installed as expected"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue