Files
flipper/scripts/update-pod-versions.sh
Pritesh Nandgaonkar 87e7afe4ab Update tutorial podfiles and GH actions (#1896)
Summary:
This PR updates the flipperkit version of the Tutorial and updates the GH action to test it without the arch flag.
This PR also fixes the script which updates the `flipperkit_version` tag in all the files. It was broken for Tutorial, as it used to replace the last released version of the pod with the current one in each file, but for some reason the flipper version in the Tutorial/Podfile was way older and it never got updated.

I have fixed the logic now to replace the current version in the file with the new one, rather than relying on only last version to be replaced.

## Changelog

- Updated the GH action of tutorial to remove the -arch flag
- Updated Tutorial/Podfile and Podfile.lock
- Updated scripts/update-pod-versions.sh

Pull Request resolved: https://github.com/facebook/flipper/pull/1896

Test Plan:
CI should be green
Tested that the version gets updated for each and every file, file tested were Flipper.podspec, FlipperKit.podspec, Sample/Podfile SampleSwift/Podfile Tutorial/Podfile

{F369967362}

{F369967395}

Reviewed By: nikoant

Differential Revision: D26275657

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 0f21a2a33c740938d2b29624e95974e80a2e38ba
2021-02-05 04:51:11 -08:00

47 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
set -e
if [ -z "$1" ]
then
echo "Please pass the root directory of flipper repository as a first argument."
exit 1
fi
if [ -z "$2" ]
then
echo "Please pass the path to update the pod version in your second argument."
exit 1
fi
darwin=false
case "$(uname)" in
Darwin*) darwin=true ;;
esac
if ! jq --version > /dev/null; then
if $darwin; then
echo "jq is not installed. Installing it..."
brew install jq
else
echo >&2 "jq is not installed. Please install it using your platform's package manager (apt-get, yum, pacman, etc.)."
exit 1
fi
fi
FLIPPER_DIR=$1
PACKAGE_VERSION=$(jq -r .version "$FLIPPER_DIR/desktop/package.json")
OLD_VERSION_POD_ARG=$(< "$2" grep "flipperkit_version =" )
OLD_VERSION="${OLD_VERSION_POD_ARG##* }"
FLIPPERKIT_VERSION_TAG='flipperkit_version'
echo "Updating $2"
if $darwin; then
sed -i '' "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${PACKAGE_VERSION}'/" "$2"
else
sed -i "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${PACKAGE_VERSION}'/" "$2"
fi