Update pod version after release (#1338)

Summary:
This diff updates the Github workflow to update pod versions after the release is published on Cocoapods.
## Changelog

- Update Github workflow to update the pod versions till the release is published in Cocoapods.

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

Test Plan:
A PR got created with the updated pod versions after the release was pushed.
https://github.com/facebook/flipper/pull/1365

Reviewed By: passy

Differential Revision: D22456857

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 335996bc1ebb6da309d3f60a8f3401559e0a83c7
This commit is contained in:
Pritesh Nandgaonkar
2020-07-10 02:18:26 -07:00
committed by Facebook GitHub Bot
parent ddf483a5e9
commit a4422a7687
3 changed files with 132 additions and 90 deletions

View File

@@ -16,6 +16,9 @@ jobs:
- name: Pod Version
run: pod --version
- name: Update Flipper version
run: ./scripts/update-pod-versions.sh ./ ./Flipper.podspec
- name: Push Flipper
run: pod trunk push Flipper.podspec --use-libraries --allow-warnings --verbose --skip-import-validation
env:
@@ -33,6 +36,9 @@ jobs:
- name: Pod Version
run: pod --version
- name: Update FlipperKit version
run: ./scripts/update-pod-versions.sh ./ ./FlipperKit.podspec
- name: Push FlipperKit
run: |
# Retry publishing FlipperKit 20 times. Putting this hack unless we have cocoapods 1.10. More information related to the bug https://github.com/CocoaPods/CocoaPods/issues/9502#issuecomment-579486258
@@ -46,6 +52,27 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Update Flipper's Podspec
run: ./scripts/update-pod-versions.sh ./ ./Flipper.podspec
- name: Update FlipperKit's Podspec
run: ./scripts/update-pod-versions.sh ./ ./FlipperKit.podspec
- name: Update Tutorial's Podfile
run: ./scripts/update-pod-versions.sh ./ ./iOS/Tutorial/Podfile
- name: Update Sample's Podfile
run: ./scripts/update-pod-versions.sh ./ ./iOS/Sample/Podfile
- name: Update SampleSwift's Podfile
run: ./scripts/update-pod-versions.sh ./ ./iOS/SampleSwift/Podfile
- name: Update Getting Started
run: ./scripts/update-pod-versions.sh ./ ./docs/getting-started/ios-native.mdx
- name: Update RN getting started guide
run: ./scripts/update-pod-versions.sh ./ ./docs/getting-started/react-native-ios.mdx
- name: Install Dependencies
run: pod repo update
@@ -94,13 +121,13 @@ jobs:
- name: Create PR to Update Podfile.lock
uses: peter-evans/create-pull-request@v2
with:
title: 'Automated: Update Podfile.lock'
title: "Automated: Update Podfile.lock"
body: |
This is an automated PR to update the Podfile.lock.
- Make sure that the Podfile.lock contains latest FlipperKit and Flipper pod versions.
- Also make sure that all the dependencies are updated to the latest one.
- This is auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
base: 'master'
base: "master"
branch-suffix: short-commit-hash
labels: automated pr
env:

View File

@@ -45,12 +45,7 @@ VERSION_PART="${2:-minor}"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SONAR_DIR="$DIR/../"
DESKTOP_DIR="$SONAR_DIR/desktop"
FLIPPERKIT_PODSPEC_PATH="$SONAR_DIR/FlipperKit.podspec"
FLIPPER_PODSPEC_PATH="$SONAR_DIR/Flipper.podspec"
TUTORIAL_PODFILE_PATH="$SONAR_DIR/iOS/Tutorial/Podfile"
IOS_GETTING_STARTED_DOC="$SONAR_DIR/docs/getting-started/ios-native.mdx"
RN_IOS_GETTING_STARTED_DOC="$SONAR_DIR/docs/getting-started/react-native-ios.mdx"
SPECS_DIR="$SONAR_DIR/Specs/"
FLIPPERKIT_VERSION_TAG='flipperkit_version'
OLD_VERSION_POD_ARG=$(< "$FLIPPER_PODSPEC_PATH" grep "$FLIPPERKIT_VERSION_TAG =" )
OLD_VERSION="${OLD_VERSION_POD_ARG##* }"
@@ -84,32 +79,6 @@ yarn --cwd "$SONAR_DIR"/react-native/react-native-flipper version --new-version
SNAPSHOT_MINOR_VERSION=$(echo "$VERSION" | sed -Ee 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\3 + 1/' | bc)
SNAPSHOT_VERSION="$(echo "$VERSION" | sed -Ee 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1.\2./')""$SNAPSHOT_MINOR_VERSION""-SNAPSHOT"
echo "Updating version $VERSION in podspecs, podfiles and in getting started docs..."
# Update Podspec files and podfiles with correct version
echo "Updating $FLIPPERKIT_PODSPEC_PATH"
if $darwin; then
sed -i '' "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$FLIPPERKIT_PODSPEC_PATH"
echo "Updating $FLIPPER_PODSPEC_PATH"
sed -i '' "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$FLIPPER_PODSPEC_PATH"
echo "Updating $IOS_GETTING_STARTED_DOC"
sed -i '' "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$IOS_GETTING_STARTED_DOC"
echo "Updating $RN_IOS_GETTING_STARTED_DOC"
sed -i '' "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$RN_IOS_GETTING_STARTED_DOC"
echo "Updating $TUTORIAL_PODFILE_PATH"
sed -i '' "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$TUTORIAL_PODFILE_PATH"
else
sed -i "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$FLIPPERKIT_PODSPEC_PATH"
echo "Updating $FLIPPER_PODSPEC_PATH"
sed -i "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$FLIPPER_PODSPEC_PATH"
echo "Updating $IOS_GETTING_STARTED_DOC"
sed -i "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$IOS_GETTING_STARTED_DOC"
echo "Updating $RN_IOS_GETTING_STARTED_DOC"
sed -i "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$RN_IOS_GETTING_STARTED_DOC"
echo "Updating $TUTORIAL_PODFILE_PATH"
sed -i "s/${FLIPPERKIT_VERSION_TAG} = ${OLD_VERSION}/${FLIPPERKIT_VERSION_TAG} = '${VERSION}'/" "$TUTORIAL_PODFILE_PATH"
fi
echo "Bumping version number for android related files..."
# Update Android related files
"$SONAR_DIR"/scripts/bump.sh "$VERSION"

46
scripts/update-pod-versions.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/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=$(< "FlipperKit.podspec" 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