diff --git a/update_script.sh b/update_script.sh index 4e8d8ec..dcb9a15 100755 --- a/update_script.sh +++ b/update_script.sh @@ -6,7 +6,7 @@ if [ $# -ne 2 ]; then echo "Example: $0 0.10.9 100082" # Extract the previous version code from export_presets.cfg - previous_version_code=$(grep 'version/code=' export_presets.cfg | tail -n1 | cut -d'=' -f2) + previous_version_code=$(grep 'version/code=' export_presets.cfg | head -n1 | cut -d'=' -f2) echo "Previous version code was: $previous_version_code" exit 1 @@ -16,7 +16,7 @@ version_name=$1 version_code=$2 # Check if a file with the version code exists in the metadata folder -if [ -f "./fastlane/metadata/android/en-US/$version_code" ]; then +if [ -f "./fastlane/metadata/android/en-US/changelogs/$version_code.txt" ]; then echo "Error: A file with the version code $version_code already exists in the metadata folder." echo "Please use a different version code or update the existing file." exit 1 @@ -29,8 +29,8 @@ if ! grep -q "## v$version_name" CHANGELOG.md; then fi # Extract the changelog for the given version and save it to a new file -changelog_file="./fastlane/metadata/android/en-US/$version_code.txt" -sed -n "/## v$version_name/,/## v/p" CHANGELOG.md | sed '$d' | sed '1d' > "$changelog_file" +changelog_file="./fastlane/metadata/android/en-US/changelogs/$version_code.txt" +sed -n "/## v$version_name/,/## v/p" CHANGELOG.md | sed '$d' | sed '1s/^## //' > "$changelog_file" # Check if the changelog was successfully extracted if [ ! -s "$changelog_file" ]; then @@ -42,13 +42,13 @@ fi echo "Changelog for version $version_name has been saved to $changelog_file" # Update version codes and version name in export_presets.cfg -sed -i '' "s/version\/code=[0-9]*/version\/code=$((version_code - 1))/" export_presets.cfg -sed -i '' "s/version\/name=\"[^\"]*\"/version\/name=\"$version_name\"/" export_presets.cfg -sed -i '' "0,/version\/code=[0-9]*/s//version\/code=$version_code/" export_presets.cfg +sed -i "s/version\/code=[0-9]*/version\/code=$version_code/" export_presets.cfg +sed -i "s/version\/name=\"[^\"]*\"/version\/name=\"$version_name\"/" export_presets.cfg +sed -i "0,/version\/code=[0-9]*/s//version\/code=$((version_code-1))/" export_presets.cfg echo "Updated version codes and version name in export_presets.cfg" # If we've made it this far, run the butler-upload script -./exports/butler-upload.sh "$version_name" +#./exports/butler-upload.sh "$version_name" echo "Upload completed successfully!" \ No newline at end of file