From ac48640b309c896020f1ca6b239fd525a1e34dfe Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Sat, 1 Jun 2024 14:10:33 -0400 Subject: [PATCH 1/5] [CI] Output version strings to file for sync --- scripts/rollup/build-all-release-channels.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/rollup/build-all-release-channels.js b/scripts/rollup/build-all-release-channels.js index aef28341746..561f56b3405 100644 --- a/scripts/rollup/build-all-release-channels.js +++ b/scripts/rollup/build-all-release-channels.js @@ -167,10 +167,14 @@ function processStable(buildDir) { fs.renameSync(filePath, filePath.replace('.js', '.classic.js')); } } + const versionString = + ReactVersion + '-www-classic-' + sha + '-' + dateString; updatePlaceholderReactVersionInCompiledArtifacts( buildDir + '/facebook-www', - ReactVersion + '-www-classic-' + sha + '-' + dateString + versionString ); + // Also save a file with the version number + fs.writeFileSync(buildDir + '/facebook-www/VERSION_CLASSIC', versionString); } if (fs.existsSync(buildDir + '/sizes')) { @@ -213,10 +217,15 @@ function processExperimental(buildDir, version) { fs.renameSync(filePath, filePath.replace('.js', '.modern.js')); } } + const versionString = + ReactVersion + '-www-modern-' + sha + '-' + dateString; updatePlaceholderReactVersionInCompiledArtifacts( buildDir + '/facebook-www', - ReactVersion + '-www-modern-' + sha + '-' + dateString + versionString ); + + // Also save a file with the version number + fs.writeFileSync(buildDir + '/facebook-www/VERSION_MODERN', versionString); } if (fs.existsSync(buildDir + '/sizes')) { From c64259927e5925c7e24eed82a7a46ea89b123404 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Sun, 2 Jun 2024 10:33:04 -0400 Subject: [PATCH 2/5] Add react native version --- scripts/rollup/build-all-release-channels.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/rollup/build-all-release-channels.js b/scripts/rollup/build-all-release-channels.js index 561f56b3405..13ac464c7ba 100644 --- a/scripts/rollup/build-all-release-channels.js +++ b/scripts/rollup/build-all-release-channels.js @@ -228,6 +228,20 @@ function processExperimental(buildDir, version) { fs.writeFileSync(buildDir + '/facebook-www/VERSION_MODERN', versionString); } + if (fs.existsSync(buildDir + '/facebook-react-native')) { + const versionString = ReactVersion + '-native-fb-' + sha + '-' + dateString; + updatePlaceholderReactVersionInCompiledArtifacts( + buildDir + '/facebook-react-native', + versionString + ); + + // Also save a file with the version number + fs.writeFileSync( + buildDir + '/facebook-react-native/VERSION_NATIVE_FB', + versionString + ); + } + if (fs.existsSync(buildDir + '/sizes')) { fs.renameSync(buildDir + '/sizes', buildDir + '/sizes-experimental'); } From 2dc8d79f13e614bbf9cb7bc2c24f92535435a9ac Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Sat, 1 Jun 2024 15:55:32 -0400 Subject: [PATCH 3/5] should sync --- .github/workflows/commit_artifacts.yml | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/.github/workflows/commit_artifacts.yml b/.github/workflows/commit_artifacts.yml index 2f49dfbf297..73f68db8e8b 100644 --- a/.github/workflows/commit_artifacts.yml +++ b/.github/workflows/commit_artifacts.yml @@ -10,7 +10,23 @@ jobs: outputs: www_branch_count: ${{ steps.check_branches.outputs.www_branch_count }} fbsource_branch_count: ${{ steps.check_branches.outputs.fbsource_branch_count }} + last_version_classic: ${{ steps.get_last_version.outputs.last_version_classic }} + last_version_modern: ${{ steps.get_last_version.outputs.last_version_modern }} + current_version_classic: ${{ steps.get_current_version.outputs.current_version_classic }} + current_version_modern: ${{ steps.get_current_version.outputs.current_version_modern }} steps: + - uses: actions/checkout@v4 + with: + ref: builds/facebook-www + - name: "Get last version string" + id: get_last_version + run: | + VERSION_CLASSIC=$(cat ./compiled/facebook-www/VERSION_CLASSIC) + VERSION_MODERN=$(cat ./compiled/facebook-www/VERSION_MODERN) + echo "Last classic version is $VERSION_CLASSIC" + echo "Last modern version is $VERSION_MODERN" + echo "last_version_classic=$VERSION_CLASSIC" >> "$GITHUB_OUTPUT" + echo "last_version_modern=$VERSION_MODERN" >> "$GITHUB_OUTPUT" - uses: actions/checkout@v4 - name: "Check branches" id: check_branches @@ -166,6 +182,15 @@ jobs: echo ${{ github.sha }} >> ./compiled/facebook-www/REVISION cp ./compiled/facebook-www/REVISION ./compiled/facebook-www/REVISION_TRANSFORMS echo ${{ github.sha }} >> ./compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION + - name: "Get current version string" + id: get_current_version + run: | + VERSION_CLASSIC=$(cat ./compiled/facebook-www/VERSION_CLASSIC) + VERSION_MODERN=$(cat ./compiled/facebook-www/VERSION_MODERN) + echo "Current classic version is $VERSION_CLASSIC" + echo "Current modern version is $VERSION_MODERN" + echo "current_version_classic=$VERSION_CLASSIC" >> "$GITHUB_OUTPUT" + echo "current_version_modern=$VERSION_MODERN" >> "$GITHUB_OUTPUT" - uses: actions/upload-artifact@v3 with: name: compiled @@ -189,8 +214,50 @@ jobs: with: name: compiled path: compiled/ + - name: Revert version changes + env: + CURRENT_VERSION_CLASSIC: ${{ needs.download_artifacts.outputs.current_version_classic }} + CURRENT_VERSION_MODERN: ${{ needs.download_artifacts.outputs.current_version_modern }} + LAST_VERSION_CLASSIC: ${{ needs.download_artifacts.outputs.last_version_classic }} + LAST_VERSION_MODERN: ${{ needs.download_artifacts.outputs.last_version_modern }} + run: | + echo "Reverting $CURRENT_VERSION_CLASSIC to $LAST_VERSION_CLASSIC" + echo "Reverting $CURRENT_VERSION_MODERN to $LAST_VERSION_MODERN" + grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled + grep -rl "$CURRENT_VERSION_MODERN" ./compiled + grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled | xargs -r sed -i -e 's/$CURRENT_VERSION_CLASSIC/$LAST_VERSION_CLASSIC/g' + grep -rl "$CURRENT_VERSION_MODERN" ./compiled | xargs -r sed -i -e 's/$CURRENT_VERSION_MODERN/$LAST_VERSION_MODERN/g' + - name: Check if only the REVISION file has changed + id: check_should_commit + run: | + echo "Full git status" + git status + echo "Status to check" + git status --porcelain | grep -qv '/REVISION$' + if git status --porcelain | grep -qv '/REVISION'; then + echo "Changes detected" + echo "should_commit=true" >> "$GITHUB_OUTPUT" + else + echo "No Changes detected" + echo "should_commit=false" >> "$GITHUB_OUTPUT" + fi + - name: Re-apply version changes + if: steps.check_should_commit.outputs.should_commit == 'true' + env: + CURRENT_VERSION_CLASSIC: ${{ needs.download_artifacts.outputs.current_version_classic }} + CURRENT_VERSION_MODERN: ${{ needs.download_artifacts.outputs.current_version_modern }} + LAST_VERSION_CLASSIC: ${{ needs.download_artifacts.outputs.last_version_classic }} + LAST_VERSION_MODERN: ${{ needs.download_artifacts.outputs.last_version_modern }} + run: | + echo "Re-applying $LAST_VERSION_CLASSIC to $CURRENT_VERSION_CLASSIC" + echo "Re-applying $LAST_VERSION_MODERN to $CURRENT_VERSION_MODERN" + grep -rl "$LAST_VERSION_CLASSIC" ./compiled || echo "No files found with $LAST_VERSION_CLASSIC" + grep -rl "$LAST_VERSION_MODERN" ./compiled || echo "No files found with $LAST_VERSION_MODERN" + grep -rl "$LAST_VERSION_CLASSIC" ./compiled | xargs -r sed -i -e 's/$LAST_VERSION_CLASSIC/$CURRENT_VERSION_CLASSIC/g' + grep -rl "$LAST_VERSION_MODERN" ./compiled | xargs -r sed -i -e 's/$LAST_VERSION_MODERN/$CURRENT_VERSION_MODERN/g' - run: git status -u - name: Commit changes to branch + if: steps.check_should_commit.outputs.should_commit == 'true' uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: | From 16e34ddc878296f5f1fa44b11ae0706343b11076 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Sun, 2 Jun 2024 11:09:54 -0400 Subject: [PATCH 4/5] Add RN support --- .github/workflows/commit_artifacts.yml | 56 +++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/.github/workflows/commit_artifacts.yml b/.github/workflows/commit_artifacts.yml index 73f68db8e8b..08c27b988bf 100644 --- a/.github/workflows/commit_artifacts.yml +++ b/.github/workflows/commit_artifacts.yml @@ -12,8 +12,10 @@ jobs: fbsource_branch_count: ${{ steps.check_branches.outputs.fbsource_branch_count }} last_version_classic: ${{ steps.get_last_version.outputs.last_version_classic }} last_version_modern: ${{ steps.get_last_version.outputs.last_version_modern }} + last_version_rn: ${{ steps.get_last_version.outputs.last_version_rn }} current_version_classic: ${{ steps.get_current_version.outputs.current_version_classic }} current_version_modern: ${{ steps.get_current_version.outputs.current_version_modern }} + current_version_rn: ${{ steps.get_current_version.outputs.current_version_rn }} steps: - uses: actions/checkout@v4 with: @@ -21,12 +23,16 @@ jobs: - name: "Get last version string" id: get_last_version run: | - VERSION_CLASSIC=$(cat ./compiled/facebook-www/VERSION_CLASSIC) - VERSION_MODERN=$(cat ./compiled/facebook-www/VERSION_MODERN) + # Empty checks only needed for backwards compatibility,can remove later. + VERSION_CLASSIC=$( [ -f ./compiled/facebook-www/VERSION_CLASSIC ] && cat ./compiled/facebook-www/VERSION_CLASSIC || echo '' ) + VERSION_MODERN=$( [ -f ./compiled/facebook-www/VERSION_MODERN ] && cat ./compiled/facebook-www/VERSION_MODERN || echo '' ) + VERSION_NATIVE_FB=$( [ -f ./compiled-rn/VERSION_NATIVE_FB ] && cat ./compiled-rn/VERSION_NATIVE_FB || echo '' ) echo "Last classic version is $VERSION_CLASSIC" echo "Last modern version is $VERSION_MODERN" + echo "Last rn version is $VERSION_NATIVE_FB" echo "last_version_classic=$VERSION_CLASSIC" >> "$GITHUB_OUTPUT" echo "last_version_modern=$VERSION_MODERN" >> "$GITHUB_OUTPUT" + echo "last_version_rn=$VERSION_NATIVE_FB" >> "$GITHUB_OUTPUT" - uses: actions/checkout@v4 - name: "Check branches" id: check_branches @@ -176,7 +182,10 @@ jobs: rm $RENDERER_FOLDER/ReactFabric-{dev,prod,profiling}.js rm $RENDERER_FOLDER/ReactNativeRenderer-{dev,prod,profiling}.js - ls -R ./compiled + # Move React Native version file + mv build/facebook-react-native/VERSION_NATIVE_FB ./compiled-rn/VERSION_NATIVE_FB + + ls -R ./compiled-rn - name: Add REVISION files run: | echo ${{ github.sha }} >> ./compiled/facebook-www/REVISION @@ -187,10 +196,13 @@ jobs: run: | VERSION_CLASSIC=$(cat ./compiled/facebook-www/VERSION_CLASSIC) VERSION_MODERN=$(cat ./compiled/facebook-www/VERSION_MODERN) + VERSION_NATIVE_FB=$(cat ./compiled-rn/VERSION_NATIVE_FB) echo "Current classic version is $VERSION_CLASSIC" echo "Current modern version is $VERSION_MODERN" + echo "Current rn version is $VERSION_NATIVE_FB" echo "current_version_classic=$VERSION_CLASSIC" >> "$GITHUB_OUTPUT" echo "current_version_modern=$VERSION_MODERN" >> "$GITHUB_OUTPUT" + echo "current_version_rn=$VERSION_NATIVE_FB" >> "$GITHUB_OUTPUT" - uses: actions/upload-artifact@v3 with: name: compiled @@ -215,6 +227,7 @@ jobs: name: compiled path: compiled/ - name: Revert version changes + if: needs.download_artifacts.outputs.last_version_classic != '' && needs.download_artifacts.outputs.last_version_modern != '' env: CURRENT_VERSION_CLASSIC: ${{ needs.download_artifacts.outputs.current_version_classic }} CURRENT_VERSION_MODERN: ${{ needs.download_artifacts.outputs.current_version_modern }} @@ -242,7 +255,7 @@ jobs: echo "should_commit=false" >> "$GITHUB_OUTPUT" fi - name: Re-apply version changes - if: steps.check_should_commit.outputs.should_commit == 'true' + if: steps.check_should_commit.outputs.should_commit == 'true' && needs.download_artifacts.outputs.last_version_classic != '' && needs.download_artifacts.outputs.last_version_modern != '' env: CURRENT_VERSION_CLASSIC: ${{ needs.download_artifacts.outputs.current_version_classic }} CURRENT_VERSION_MODERN: ${{ needs.download_artifacts.outputs.current_version_modern }} @@ -278,13 +291,46 @@ jobs: with: ref: builds/facebook-fbsource - name: Ensure clean directory - run: rm -rf compiled + run: rm -rf compiled-rn - uses: actions/download-artifact@v3 with: name: compiled-rn path: compiled-rn/ + - name: Revert version changes + if: needs.download_artifacts.outputs.last_version_rn != '' + env: + CURRENT_VERSION: ${{ needs.download_artifacts.outputs.current_version_rn }} + LAST_VERSION: ${{ needs.download_artifacts.outputs.last_version_rn }} + run: | + echo "Reverting $CURRENT_VERSION to $LAST_VERSION" + grep -rl "$CURRENT_VERSION" ./compiled-rn + grep -rl "$CURRENT_VERSION" ./compiled-rn | xargs -r sed -i -e 's/$CURRENT_VERSION/$LAST_VERSION/ g' + - name: Check if only the REVISION file has changed + id: check_should_commit + run: | + echo "Full git status" + git status + echo "Status to check" + git status --porcelain | grep -qv '/REVISION$' + if git status --porcelain | grep -qv '/REVISION'; then + echo "Changes detected" + echo "should_commit=true" >> "$GITHUB_OUTPUT" + else + echo "No Changes detected" + echo "should_commit=false" >> "$GITHUB_OUTPUT" + fi + - name: Re-apply version changes + if: steps.check_should_commit.outputs.should_commit == 'true' && needs.download_artifacts.outputs.last_version_rn != '' + env: + CURRENT_VERSION: ${{ needs.download_artifacts.outputs.current_version_rn }} + LAST_VERSION: ${{ needs.download_artifacts.outputs.last_version_rn }} + run: | + echo "Re-applying $LAST_VERSION to $CURRENT_VERSION" + grep -rl "$LAST_VERSION" ./compiled-rn || echo "No files found with $LAST_VERSION" + grep -rl "$LAST_VERSION" ./compiled-rn | xargs -r sed -i -e 's/$LAST_VERSION/$CURRENT_VERSION/g' - run: git status -u - name: Commit changes to branch + if: steps.check_should_commit.outputs.should_commit == 'true' uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: | From 554476cec73cc04aae9fdb72bb32a23e1a9a19f9 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Sun, 2 Jun 2024 12:15:07 -0400 Subject: [PATCH 5/5] Fixes and logging --- .github/workflows/commit_artifacts.yml | 70 +++++++++++++++++--------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/.github/workflows/commit_artifacts.yml b/.github/workflows/commit_artifacts.yml index 08c27b988bf..0416760a10b 100644 --- a/.github/workflows/commit_artifacts.yml +++ b/.github/workflows/commit_artifacts.yml @@ -10,9 +10,9 @@ jobs: outputs: www_branch_count: ${{ steps.check_branches.outputs.www_branch_count }} fbsource_branch_count: ${{ steps.check_branches.outputs.fbsource_branch_count }} - last_version_classic: ${{ steps.get_last_version.outputs.last_version_classic }} - last_version_modern: ${{ steps.get_last_version.outputs.last_version_modern }} - last_version_rn: ${{ steps.get_last_version.outputs.last_version_rn }} + last_version_classic: ${{ steps.get_last_version_www.outputs.last_version_classic }} + last_version_modern: ${{ steps.get_last_version_www.outputs.last_version_modern }} + last_version_rn: ${{ steps.get_last_version_rn.outputs.last_version_rn }} current_version_classic: ${{ steps.get_current_version.outputs.current_version_classic }} current_version_modern: ${{ steps.get_current_version.outputs.current_version_modern }} current_version_rn: ${{ steps.get_current_version.outputs.current_version_rn }} @@ -20,18 +20,25 @@ jobs: - uses: actions/checkout@v4 with: ref: builds/facebook-www - - name: "Get last version string" - id: get_last_version + - name: "Get last version string for www" + id: get_last_version_www run: | # Empty checks only needed for backwards compatibility,can remove later. VERSION_CLASSIC=$( [ -f ./compiled/facebook-www/VERSION_CLASSIC ] && cat ./compiled/facebook-www/VERSION_CLASSIC || echo '' ) VERSION_MODERN=$( [ -f ./compiled/facebook-www/VERSION_MODERN ] && cat ./compiled/facebook-www/VERSION_MODERN || echo '' ) - VERSION_NATIVE_FB=$( [ -f ./compiled-rn/VERSION_NATIVE_FB ] && cat ./compiled-rn/VERSION_NATIVE_FB || echo '' ) echo "Last classic version is $VERSION_CLASSIC" echo "Last modern version is $VERSION_MODERN" - echo "Last rn version is $VERSION_NATIVE_FB" echo "last_version_classic=$VERSION_CLASSIC" >> "$GITHUB_OUTPUT" echo "last_version_modern=$VERSION_MODERN" >> "$GITHUB_OUTPUT" + - uses: actions/checkout@v4 + with: + ref: builds/facebook-fbsource + - name: "Get last version string for rn" + id: get_last_version_rn + run: | + # Empty checks only needed for backwards compatibility,can remove later. + VERSION_NATIVE_FB=$( [ -f ./compiled-rn/VERSION_NATIVE_FB ] && cat ./compiled-rn/VERSION_NATIVE_FB || echo '' ) + echo "Last rn version is $VERSION_NATIVE_FB" echo "last_version_rn=$VERSION_NATIVE_FB" >> "$GITHUB_OUTPUT" - uses: actions/checkout@v4 - name: "Check branches" @@ -235,18 +242,20 @@ jobs: LAST_VERSION_MODERN: ${{ needs.download_artifacts.outputs.last_version_modern }} run: | echo "Reverting $CURRENT_VERSION_CLASSIC to $LAST_VERSION_CLASSIC" + grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled || echo "No files found with $CURRENT_VERSION_CLASSIC" + grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled | xargs -r sed -i -e "s/$CURRENT_VERSION_CLASSIC/$LAST_VERSION_CLASSIC/g" + grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled || echo "Classic version reverted" + echo "====================" echo "Reverting $CURRENT_VERSION_MODERN to $LAST_VERSION_MODERN" - grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled - grep -rl "$CURRENT_VERSION_MODERN" ./compiled - grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled | xargs -r sed -i -e 's/$CURRENT_VERSION_CLASSIC/$LAST_VERSION_CLASSIC/g' - grep -rl "$CURRENT_VERSION_MODERN" ./compiled | xargs -r sed -i -e 's/$CURRENT_VERSION_MODERN/$LAST_VERSION_MODERN/g' + grep -rl "$CURRENT_VERSION_MODERN" ./compiled || echo "No files found with $CURRENT_VERSION_MODERN" + grep -rl "$CURRENT_VERSION_MODERN" ./compiled | xargs -r sed -i -e "s/$CURRENT_VERSION_MODERN/$LAST_VERSION_MODERN/g" + grep -rl "$CURRENT_VERSION_MODERN" ./compiled || echo "Modern version reverted" - name: Check if only the REVISION file has changed id: check_should_commit run: | echo "Full git status" git status - echo "Status to check" - git status --porcelain | grep -qv '/REVISION$' + echo "====================" if git status --porcelain | grep -qv '/REVISION'; then echo "Changes detected" echo "should_commit=true" >> "$GITHUB_OUTPUT" @@ -263,14 +272,21 @@ jobs: LAST_VERSION_MODERN: ${{ needs.download_artifacts.outputs.last_version_modern }} run: | echo "Re-applying $LAST_VERSION_CLASSIC to $CURRENT_VERSION_CLASSIC" - echo "Re-applying $LAST_VERSION_MODERN to $CURRENT_VERSION_MODERN" grep -rl "$LAST_VERSION_CLASSIC" ./compiled || echo "No files found with $LAST_VERSION_CLASSIC" + grep -rl "$LAST_VERSION_CLASSIC" ./compiled | xargs -r sed -i -e "s/$LAST_VERSION_CLASSIC/$CURRENT_VERSION_CLASSIC/g" + grep -rl "$LAST_VERSION_CLASSIC" ./compiled || echo "Classic version re-applied" + echo "====================" + echo "Re-applying $LAST_VERSION_MODERN to $CURRENT_VERSION_MODERN" grep -rl "$LAST_VERSION_MODERN" ./compiled || echo "No files found with $LAST_VERSION_MODERN" - grep -rl "$LAST_VERSION_CLASSIC" ./compiled | xargs -r sed -i -e 's/$LAST_VERSION_CLASSIC/$CURRENT_VERSION_CLASSIC/g' - grep -rl "$LAST_VERSION_MODERN" ./compiled | xargs -r sed -i -e 's/$LAST_VERSION_MODERN/$CURRENT_VERSION_MODERN/g' - - run: git status -u - - name: Commit changes to branch + grep -rl "$LAST_VERSION_MODERN" ./compiled | xargs -r sed -i -e "s/$LAST_VERSION_MODERN/$CURRENT_VERSION_MODERN/g" + grep -rl "$LAST_VERSION_MODERN" ./compiled || echo "Classic version re-applied" + - name: Will commit these changes if: steps.check_should_commit.outputs.should_commit == 'true' + run: | + echo ":" + git status -u + - name: Commit changes to branch + if: false && steps.check_should_commit.outputs.should_commit == 'true' uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: | @@ -303,15 +319,16 @@ jobs: LAST_VERSION: ${{ needs.download_artifacts.outputs.last_version_rn }} run: | echo "Reverting $CURRENT_VERSION to $LAST_VERSION" - grep -rl "$CURRENT_VERSION" ./compiled-rn - grep -rl "$CURRENT_VERSION" ./compiled-rn | xargs -r sed -i -e 's/$CURRENT_VERSION/$LAST_VERSION/ g' + grep -rl "$CURRENT_VERSION" ./compiled-rn || echo "No files found with $CURRENT_VERSION" + grep -rl "$CURRENT_VERSION" ./compiled-rn | xargs -r sed -i -e "s/$CURRENT_VERSION/$LAST_VERSION/g" + grep -rl "$CURRENT_VERSION" ./compiled-rn || echo "Version reverted" - name: Check if only the REVISION file has changed id: check_should_commit run: | echo "Full git status" git status - echo "Status to check" - git status --porcelain | grep -qv '/REVISION$' + echo "====================" + echo "Checking for changes" if git status --porcelain | grep -qv '/REVISION'; then echo "Changes detected" echo "should_commit=true" >> "$GITHUB_OUTPUT" @@ -327,8 +344,13 @@ jobs: run: | echo "Re-applying $LAST_VERSION to $CURRENT_VERSION" grep -rl "$LAST_VERSION" ./compiled-rn || echo "No files found with $LAST_VERSION" - grep -rl "$LAST_VERSION" ./compiled-rn | xargs -r sed -i -e 's/$LAST_VERSION/$CURRENT_VERSION/g' - - run: git status -u + grep -rl "$LAST_VERSION" ./compiled-rn | xargs -r sed -i -e "s/$LAST_VERSION/$CURRENT_VERSION/g" + grep -rl "$LAST_VERSION" ./compiled-rn || echo "Version re-applied" + - name: Will commit these changes + if: steps.check_should_commit.outputs.should_commit == 'true' + run: | + echo ":" + git status -u - name: Commit changes to branch if: steps.check_should_commit.outputs.should_commit == 'true' uses: stefanzweifel/git-auto-commit-action@v4