Skip to content

Commit

Permalink
Merge pull request #1129 from dotintent/chore/update-pipeline
Browse files Browse the repository at this point in the history
chore: update compileSdkVersion for RN 0.70 pipeline
  • Loading branch information
dominik-czupryna-withintent authored Oct 27, 2023
2 parents 7332af5 + 26ffb98 commit e94ae41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup_test_project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions scripts/copyExampleProjectFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -136,7 +138,7 @@ const copyExampleProjectFiles = () => {
copyReactNativeConfig()
copyBabelConfig()
changePackageJsonName()
setMinSdkVersion()
setCompileSdkVersion()
}

copyExampleProjectFiles()

0 comments on commit e94ae41

Please sign in to comment.