mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 05:55:38 +00:00
Updated version extractor [skip ci]
This commit is contained in:
parent
2835ac9b3e
commit
a0fe34abf7
31
automation_tools/version_extractor.sh
Executable file
31
automation_tools/version_extractor.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Set the file paths
|
||||||
|
appdata="net.retrodeck.retrodeck.appdata.xml"
|
||||||
|
manifest="net.retrodeck.retrodeck.yml"
|
||||||
|
manifest_content=$(cat "$manifest")
|
||||||
|
|
||||||
|
# Getting latest RetroDECK release info
|
||||||
|
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/XargonWan/RetroDECK/releases/latest")
|
||||||
|
# Extracting tag name from the latest release
|
||||||
|
TAG=$(echo "$LATEST_RELEASE" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
|
# Printing results
|
||||||
|
echo "repo: $TAG"
|
||||||
|
|
||||||
|
# Extract the version from the net.retrodeck.retrodeck.appdata.xml file
|
||||||
|
appdata_version=$(grep -oPm1 "(?<=<release version=\")[^\"]+" "$appdata")
|
||||||
|
echo "xml: $appdata_version"
|
||||||
|
|
||||||
|
# Use awk to extract the value of the first iteration of VERSION variable
|
||||||
|
manifest_version=$(echo "$manifest_content" | awk '/VERSION=/ && !/#/ { sub(/.*VERSION=/, ""); sub(/#.*/, ""); print; exit }')
|
||||||
|
# Trim leading and trailing whitespace
|
||||||
|
manifest_version=$(echo "$manifest_version" | awk '{$1=$1;print}')
|
||||||
|
echo "yml: $manifest_version"
|
||||||
|
|
||||||
|
# Check if the versions are equal
|
||||||
|
if [ "$appdata_version" == "$manifest_version" ]; then
|
||||||
|
echo "The versions in the manifest and in the appdata are equal. Well done, you didnt forget the patch notes (probably)!"
|
||||||
|
else
|
||||||
|
echo "Error: The versions in the manifest and in the appdata mismatch."
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in a new issue