From 835cca053e79e55fbb9013de66a3e85bb4526a6a Mon Sep 17 00:00:00 2001 From: alduzy Date: Wed, 6 Nov 2024 14:53:22 +0100 Subject: [PATCH 1/5] chore: added podfile update workflow --- .github/workflows/ios-podfiles-update.yml | 63 +++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/ios-podfiles-update.yml diff --git a/.github/workflows/ios-podfiles-update.yml b/.github/workflows/ios-podfiles-update.yml new file mode 100644 index 0000000000..fa86d6b526 --- /dev/null +++ b/.github/workflows/ios-podfiles-update.yml @@ -0,0 +1,63 @@ +name: Update Podfile + +on: + push: + branches: + - main + paths: + - 'package.json' + - 'Example/package.json' + - 'FabricExample/package.json' +jobs: + update_podfile: + runs-on: ubuntu-latest + timeout-minutes: 60 + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Use Node.js 18 + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install CocoaPods + run: sudo gem install cocoapods + - name: Identify changed package.json files + id: changes + run: | + ROOT_CHANGED=false + EXAMPLE_CHANGED=false + FABRIC_CHANGED=false + + if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^package.json'; then + ROOT_CHANGED=true + fi + + if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^Example/package.json'; then + EXAMPLE_CHANGED=true + fi + + if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^FabricExample/package.json'; then + FABRIC_CHANGED=true + fi + + echo "ROOT_CHANGED=${ROOT_CHANGED}" >> $GITHUB_ENV + echo "EXAMPLE_CHANGED=${EXAMPLE_CHANGED}" >> $GITHUB_ENV + echo "FABRIC_CHANGED=${FABRIC_CHANGED}" >> $GITHUB_ENV + + - name: Update Podfile in Example + if: env.ROOT_CHANGED == 'true' || env.EXAMPLE_CHANGED == 'true' + run: | + cd Example + yarn install + cd ios + pod install + - name: Update Podfile in FabricExample + if: env.ROOT_CHANGED == 'true' || env.FABRIC_CHANGED == 'true' + run: | + cd FabricExample + yarn install + cd ios + pod install \ No newline at end of file From 22037c42e2922d37ae54677d4a053ff3fcb7868b Mon Sep 17 00:00:00 2001 From: alduzy Date: Wed, 6 Nov 2024 15:15:28 +0100 Subject: [PATCH 2/5] formatting --- .github/workflows/ios-podfiles-update.yml | 68 +++++++++++------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ios-podfiles-update.yml b/.github/workflows/ios-podfiles-update.yml index fa86d6b526..e135a1080b 100644 --- a/.github/workflows/ios-podfiles-update.yml +++ b/.github/workflows/ios-podfiles-update.yml @@ -22,42 +22,42 @@ jobs: uses: actions/setup-node@v4 with: node-version: 18 - - name: Install CocoaPods - run: sudo gem install cocoapods - - name: Identify changed package.json files - id: changes - run: | - ROOT_CHANGED=false - EXAMPLE_CHANGED=false - FABRIC_CHANGED=false + - name: Install CocoaPods + run: sudo gem install cocoapods + - name: Identify changed package.json files + id: changes + run: | + ROOT_CHANGED=false + EXAMPLE_CHANGED=false + FABRIC_CHANGED=false - if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^package.json'; then - ROOT_CHANGED=true - fi + if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^package.json'; then + ROOT_CHANGED=true + fi - if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^Example/package.json'; then - EXAMPLE_CHANGED=true - fi + if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^Example/package.json'; then + EXAMPLE_CHANGED=true + fi - if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^FabricExample/package.json'; then - FABRIC_CHANGED=true - fi + if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^FabricExample/package.json'; then + FABRIC_CHANGED=true + fi - echo "ROOT_CHANGED=${ROOT_CHANGED}" >> $GITHUB_ENV - echo "EXAMPLE_CHANGED=${EXAMPLE_CHANGED}" >> $GITHUB_ENV - echo "FABRIC_CHANGED=${FABRIC_CHANGED}" >> $GITHUB_ENV + echo "ROOT_CHANGED=${ROOT_CHANGED}" >> $GITHUB_ENV + echo "EXAMPLE_CHANGED=${EXAMPLE_CHANGED}" >> $GITHUB_ENV + echo "FABRIC_CHANGED=${FABRIC_CHANGED}" >> $GITHUB_ENV - - name: Update Podfile in Example - if: env.ROOT_CHANGED == 'true' || env.EXAMPLE_CHANGED == 'true' - run: | - cd Example - yarn install - cd ios - pod install - - name: Update Podfile in FabricExample - if: env.ROOT_CHANGED == 'true' || env.FABRIC_CHANGED == 'true' - run: | - cd FabricExample - yarn install - cd ios - pod install \ No newline at end of file + - name: Update Podfile in Example + if: env.ROOT_CHANGED == 'true' || env.EXAMPLE_CHANGED == 'true' + run: | + cd Example + yarn install + cd ios + pod install + - name: Update Podfile in FabricExample + if: env.ROOT_CHANGED == 'true' || env.FABRIC_CHANGED == 'true' + run: | + cd FabricExample + yarn install + cd ios + pod install From 840d769db7d91b125e38f50bd821714357957da5 Mon Sep 17 00:00:00 2001 From: alduzy Date: Thu, 7 Nov 2024 11:44:02 +0100 Subject: [PATCH 3/5] added pod update script to package-json --- .github/workflows/ios-podfiles-update.yml | 12 ++---------- package.json | 3 ++- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ios-podfiles-update.yml b/.github/workflows/ios-podfiles-update.yml index e135a1080b..472faed23d 100644 --- a/.github/workflows/ios-podfiles-update.yml +++ b/.github/workflows/ios-podfiles-update.yml @@ -49,15 +49,7 @@ jobs: - name: Update Podfile in Example if: env.ROOT_CHANGED == 'true' || env.EXAMPLE_CHANGED == 'true' - run: | - cd Example - yarn install - cd ios - pod install + run: APP_DIR=Example yarn pod-update - name: Update Podfile in FabricExample if: env.ROOT_CHANGED == 'true' || env.FABRIC_CHANGED == 'true' - run: | - cd FabricExample - yarn install - cd ios - pod install + run: APP_DIR=FabricExample yarn pod-update diff --git a/package.json b/package.json index 3db9d54cb1..0d88bb104c 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "release": "yarn prepare && npm login && release-it", "prepare": "bob build && husky install", "architectures-consistency-check": "node ./scripts/codegen-check-consistency.js", - "sync-architectures": "node ./scripts/codegen-sync-archs.js" + "sync-architectures": "node ./scripts/codegen-sync-archs.js", + "pod-update": "cd $APP_DIR/ios && pod install && cd ../.." }, "main": "lib/commonjs/index", "module": "lib/module/index", From 55b1b92bf55443957eeb092a60cf1413ccf36274 Mon Sep 17 00:00:00 2001 From: alduzy Date: Thu, 7 Nov 2024 11:52:00 +0100 Subject: [PATCH 4/5] running workflow for v change only --- .github/workflows/ios-podfiles-update.yml | 43 ++++++----------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ios-podfiles-update.yml b/.github/workflows/ios-podfiles-update.yml index 472faed23d..a2849ea3d2 100644 --- a/.github/workflows/ios-podfiles-update.yml +++ b/.github/workflows/ios-podfiles-update.yml @@ -1,4 +1,4 @@ -name: Update Podfile +name: Update Podfiles on: push: @@ -6,8 +6,6 @@ on: - main paths: - 'package.json' - - 'Example/package.json' - - 'FabricExample/package.json' jobs: update_podfile: runs-on: ubuntu-latest @@ -18,38 +16,19 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Check for version change + run: | + VERSION_CHANGE=$(git diff ${{ github.event.before }} ${{ github.sha }} -- package.json | grep -E "^\+.*\"version\":") + echo "Version change detected: $VERSION_CHANGE" + if [ -z "$VERSION_CHANGE" ]; then + echo "No version change detected, exiting." + exit 0 + fi - name: Use Node.js 18 uses: actions/setup-node@v4 with: node-version: 18 - name: Install CocoaPods run: sudo gem install cocoapods - - name: Identify changed package.json files - id: changes - run: | - ROOT_CHANGED=false - EXAMPLE_CHANGED=false - FABRIC_CHANGED=false - - if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^package.json'; then - ROOT_CHANGED=true - fi - - if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^Example/package.json'; then - EXAMPLE_CHANGED=true - fi - - if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q '^FabricExample/package.json'; then - FABRIC_CHANGED=true - fi - - echo "ROOT_CHANGED=${ROOT_CHANGED}" >> $GITHUB_ENV - echo "EXAMPLE_CHANGED=${EXAMPLE_CHANGED}" >> $GITHUB_ENV - echo "FABRIC_CHANGED=${FABRIC_CHANGED}" >> $GITHUB_ENV - - - name: Update Podfile in Example - if: env.ROOT_CHANGED == 'true' || env.EXAMPLE_CHANGED == 'true' - run: APP_DIR=Example yarn pod-update - - name: Update Podfile in FabricExample - if: env.ROOT_CHANGED == 'true' || env.FABRIC_CHANGED == 'true' - run: APP_DIR=FabricExample yarn pod-update + - name: Update Podfiles + run: APP_DIR=Example yarn pod-update && APP_DIR=FabricExample yarn pod-update From b96af98e4e138adbd264dbe04a3cd8d96f1b3cb4 Mon Sep 17 00:00:00 2001 From: alduzy Date: Thu, 7 Nov 2024 11:52:38 +0100 Subject: [PATCH 5/5] replace worklfow with release-it hook --- .github/workflows/ios-podfiles-update.yml | 34 ----------------------- package.json | 5 ++++ 2 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/ios-podfiles-update.yml diff --git a/.github/workflows/ios-podfiles-update.yml b/.github/workflows/ios-podfiles-update.yml deleted file mode 100644 index a2849ea3d2..0000000000 --- a/.github/workflows/ios-podfiles-update.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Update Podfiles - -on: - push: - branches: - - main - paths: - - 'package.json' -jobs: - update_podfile: - runs-on: ubuntu-latest - timeout-minutes: 60 - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Check for version change - run: | - VERSION_CHANGE=$(git diff ${{ github.event.before }} ${{ github.sha }} -- package.json | grep -E "^\+.*\"version\":") - echo "Version change detected: $VERSION_CHANGE" - if [ -z "$VERSION_CHANGE" ]; then - echo "No version change detected, exiting." - exit 0 - fi - - name: Use Node.js 18 - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: Install CocoaPods - run: sudo gem install cocoapods - - name: Update Podfiles - run: APP_DIR=Example yarn pod-update && APP_DIR=FabricExample yarn pod-update diff --git a/package.json b/package.json index 0d88bb104c..db96fcd001 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,11 @@ "sync-architectures": "node ./scripts/codegen-sync-archs.js", "pod-update": "cd $APP_DIR/ios && pod install && cd ../.." }, + "release-it": { + "hooks": { + "after:bump": "APP_DIR=Example yarn pod-update && APP_DIR=FabricExample yarn pod-update" + } + }, "main": "lib/commonjs/index", "module": "lib/module/index", "react-native": "src/index",