diff --git a/auth/scripts/release_tag.sh b/auth/scripts/release_tag.sh index fee85d2d74..fa6bab6f00 100755 --- a/auth/scripts/release_tag.sh +++ b/auth/scripts/release_tag.sh @@ -1,5 +1,3 @@ -#!/bin/sh - #!/bin/bash # Function to display usage @@ -20,6 +18,9 @@ cd "$(dirname "$0")/.." # Get the tag from the command line argument TAG=$1 +# Define the appdata file path - use absolute path to avoid directory navigation issues +PROJECT_ROOT=$(pwd) +APPDATA_FILE="${PROJECT_ROOT}/linux/packaging/enteauth.appdata.xml" # Get the version from the pubspec.yaml file and cut everything after the + VERSION=$(grep "^version:" pubspec.yaml | awk '{ print $2 }' | cut -d '+' -f 1) @@ -39,8 +40,34 @@ if [[ $TAG != *$VERSION ]]; then exit 1 fi -## If all checks pass, create the tag +# Extract version number from the tag (remove prefix) +TAG_VERSION=${TAG#$PREFIX} + +# Check if this version is already in the releases section of the appdata.xml file +if ! grep -q "" + + # Use a more reliable approach with awk instead of sed for cross-platform compatibility + echo "Creating temporary file with updated content..." + awk '//{print $0; print " "; next}1' "$APPDATA_FILE" > "${APPDATA_FILE}.tmp" + mv "${APPDATA_FILE}.tmp" "$APPDATA_FILE" + + echo "Added release entry for version $TAG_VERSION with date $TODAY" + + # Stage and commit the updated appdata.xml file + git add "$APPDATA_FILE" + git commit -m "Add release $TAG_VERSION to appdata.xml" + echo "Committed appdata.xml changes for version $TAG_VERSION" +fi + +# If all checks pass, create the tag git tag $TAG echo "Tag $TAG created." -exit 0 +exit 0 \ No newline at end of file