Skip to content

Commit

Permalink
fix update_script
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jul 6, 2024
1 parent f0777cd commit c280027
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions update_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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!"

0 comments on commit c280027

Please sign in to comment.