53 lines
1.5 KiB
Bash
53 lines
1.5 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
repo="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
|
|
version="$(tr -d '\r\n' < "$repo/VERSION")"
|
|
|
|
printf '%s' "$version" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$' || {
|
|
echo "VERSION is not a semantic version" >&2
|
|
exit 1
|
|
}
|
|
|
|
require_literal() {
|
|
file="$1"
|
|
grep -F "$version" "$repo/$file" >/dev/null || {
|
|
echo "$file does not reference release $version" >&2
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
for file in \
|
|
CHANGELOG.md \
|
|
deploy/README.md \
|
|
deploy/compose.dolphin.yml \
|
|
deploy/compose.yml \
|
|
deploy/ludarium-unraid.xml \
|
|
deploy/unraid/my-Ludarium.xml
|
|
do
|
|
require_literal "$file"
|
|
done
|
|
|
|
grep -F 'ReadAllText('"'"'$(MSBuildThisFileDirectory)VERSION'"'"')' "$repo/Directory.Build.props" >/dev/null || {
|
|
echo "Directory.Build.props does not derive the assembly version from VERSION" >&2
|
|
exit 1
|
|
}
|
|
for dockerfile in Dockerfile Dockerfile.unraid
|
|
do
|
|
grep -E '^COPY .*VERSION.*Directory.Build.props|^COPY .*Directory.Build.props.*VERSION' "$repo/$dockerfile" >/dev/null || {
|
|
echo "$dockerfile does not copy VERSION into the build context" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
grep -F 'ReleaseIdentity.Version' "$repo/src/Ludarium.Api/Program.cs" >/dev/null
|
|
grep -F 'release_identity="$(tr' "$repo/deploy/run-candidate-gate.sh" >/dev/null
|
|
|
|
if grep -R -n -E --include='*.cs' '0\.4\.[0-9]+-rc\.[0-9]+' \
|
|
"$repo/src/Ludarium.Api" "$repo/src/Ludarium.Application" "$repo/src/Ludarium.Infrastructure" |
|
|
grep -v -F "$version"; then
|
|
echo "A runtime release identifier bypasses ReleaseIdentity" >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf 'release identity verified: %s\n' "$version"
|