From 26ffb9869abf760bfb39d2d69340f23ae58fdab3 Mon Sep 17 00:00:00 2001 From: Dominik Czupryna Date: Fri, 27 Oct 2023 09:26:14 +0200 Subject: [PATCH] chore: update compileSdkVersion for RN 0.70 pipeline --- .github/actions/setup_test_project/action.yml | 2 +- scripts/copyExampleProjectFiles.js | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup_test_project/action.yml b/.github/actions/setup_test_project/action.yml index 41fb355d..209d5601 100644 --- a/.github/actions/setup_test_project/action.yml +++ b/.github/actions/setup_test_project/action.yml @@ -32,7 +32,7 @@ runs: ${{ runner.os }}-${{ inputs.REACT_NATIVE_VERSION }}-yarn- - name: Copy project files - run: node ./scripts/copyExampleProjectFiles.js + run: REACT_NATIVE_VERSION=${{ inputs.REACT_NATIVE_VERSION }} node ./scripts/copyExampleProjectFiles.js shell: bash - name: Install dependencies diff --git a/scripts/copyExampleProjectFiles.js b/scripts/copyExampleProjectFiles.js index d6246385..a455cd08 100644 --- a/scripts/copyExampleProjectFiles.js +++ b/scripts/copyExampleProjectFiles.js @@ -119,12 +119,14 @@ const changePackageJsonName = () => { fs.writeFileSync(packageJsonDestinationPath, JSON.stringify(packageJson, null, 2) + '\n') } -const setMinSdkVersion = () => { - const gradlePath = path.join(__dirname, TEST_PROJECT_DIR_NAME, 'android', 'app', 'build.gradle') - const gradleLines = fs.readFileSync(gradlePath, 'utf8').split('\n') - const indexOfManifestTagEndLine = gradleLines.findIndex(line => line.includes('minSdkVersion')) - gradleLines[indexOfManifestTagEndLine] = 'minSdkVersion 23' - fs.writeFileSync(gradlePath, gradleLines.join('\n')) +const setCompileSdkVersion = () => { + if (process.env.REACT_NATIVE_VERSION.includes('0.70')) { + const gradlePath = path.join(__dirname, TEST_PROJECT_DIR_NAME, 'android', 'app', 'build.gradle') + const gradleLines = fs.readFileSync(gradlePath, 'utf8').split('\n') + const indexOfManifestTagEndLine = gradleLines.findIndex(line => line.includes('compileSdkVersion')) + gradleLines[indexOfManifestTagEndLine] = 'compileSdkVersion 32' + fs.writeFileSync(gradlePath, gradleLines.join('\n')) + } } const copyExampleProjectFiles = () => { @@ -136,7 +138,7 @@ const copyExampleProjectFiles = () => { copyReactNativeConfig() copyBabelConfig() changePackageJsonName() - setMinSdkVersion() + setCompileSdkVersion() } copyExampleProjectFiles()