2022-04-06 15:47:02 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
version_file=$1
|
2022-04-06 16:56:52 +00:00
|
|
|
version_metadata_file=$2
|
2022-04-06 15:47:02 +00:00
|
|
|
version=$(awk '$1 == "Version" && $2 == "=" { gsub(/"/, "", $3); print $3 }' <"${version_file}")
|
|
|
|
prerelease=$(awk '$1 == "VersionPrerelease" && $2 == "=" { gsub(/"/, "", $3); print $3 }' <"${version_file}")
|
2022-04-06 16:56:52 +00:00
|
|
|
metadata=$(awk '$1 == "VersionMetadata" && $2 == "=" { gsub(/"/, "", $3); print $3 }' <"${version_metadata_file}")
|
2022-04-06 15:47:02 +00:00
|
|
|
|
2022-04-06 16:56:52 +00:00
|
|
|
if [ -n "$metadata" ] && [ -n "$prerelease" ]; then
|
|
|
|
echo "${version}-${prerelease}+${metadata}"
|
|
|
|
elif [ -n "$metadata" ]; then
|
|
|
|
echo "${version}+${metadata}"
|
|
|
|
elif [ -n "$prerelease" ]; then
|
2022-04-06 15:47:02 +00:00
|
|
|
echo "${version}-${prerelease}"
|
|
|
|
else
|
|
|
|
echo "${version}"
|
|
|
|
fi
|