From 6f9d82117e9e8879683f4a6f66ae9c8f3bae688a Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Fri, 1 May 2020 09:04:49 -0700 Subject: [PATCH] Publish pods gh (#1083) Summary: This PR adds a github action to publish pods on a new tag. It also tries to fix a race condition which happens when we try to publish FlipperKit pod. During the release of FlipperKit pod, we rely on the newly published Flipper Pod, and sometimes the release of Flipper Pod takes a time to get updated in the cocoapods trunk. This is a known issue by the Cocoapods and they will be shipping a fix to this in Cocoapods 1.10. Till then we can keep retrying for 5 times. Ref: https://github.com/CocoaPods/CocoaPods/issues/9502#issuecomment-579486258 ## Changelog - Adds Github actions to publish cocoapods. - Removes the Circle CI config to publish on cocoapods Pull Request resolved: https://github.com/facebook/flipper/pull/1083 Test Plan: I tested this action by running it on this PR and it worked fine. Reviewed By: jknoxville Differential Revision: D21348084 Pulled By: priteshrnandgaonkar fbshipit-source-id: f33f3cdef43ae032ad42c94db72323212e40ec67 --- .circleci/config.yml | 25 ------------------ .github/workflows/publish-pods.yml | 41 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/publish-pods.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index cab56a855..f588925e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,25 +28,6 @@ jobs: command: | yes | sdkmanager "platforms;android-27" || true ./gradlew :android:assembleRelease && scripts/publish-android-release.sh - publish-pods: - macos: - xcode: "10.2.1" - steps: - - checkout - - run: curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf - - run: - name: "Pod version" - command: | - pod --version - - run: - name: "Push Flipper Pod" - command: | - pod trunk push ./Flipper.podspec --use-libraries --allow-warnings --verbose --skip-import-validation - - run: - name: "Push FlipperKit Pod" - command: | - pod trunk push ./FlipperKit.podspec --use-libraries --allow-warnings --verbose --skip-import-validation --swift-version=4.2 - workflows: version: 2 build-and-deploy: @@ -61,9 +42,3 @@ workflows: only: /^v.*/ branches: ignore: /.*/ - - publish-pods: - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ diff --git a/.github/workflows/publish-pods.yml b/.github/workflows/publish-pods.yml new file mode 100644 index 000000000..70394523c --- /dev/null +++ b/.github/workflows/publish-pods.yml @@ -0,0 +1,41 @@ +name: Publish Pods +on: + push: + tags: + - v* + +jobs: + publish_flipper_pod: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Dependences + run: pod repo update + + - name: Pod Version + run: pod --version + + - name: Push Flipper + run: pod trunk push Flipper.podspec --use-libraries --allow-warnings --verbose --skip-import-validation + env: + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} + + publish_flipperkit_pod: + needs: publish_flipper_pod + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Dependences + run: pod repo update + + - name: Pod Version + run: pod --version + + - name: Push FlipperKit + run: | + # Retry publishing FlipperKit 5 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 + for i in {1..5}; do pod trunk push FlipperKit.podspec --use-libraries --allow-warnings --verbose --skip-import-validation && break || sleep 20; done + env: + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}