diff --git a/template/GITLABRUNNER.MD b/template/GITLABRUNNER.MD index 8f31cd7..bf18698 100644 --- a/template/GITLABRUNNER.MD +++ b/template/GITLABRUNNER.MD @@ -1,4 +1,3 @@ - You can config gitlab CI runner to create build automatically. ## Config workflow @@ -24,7 +23,6 @@ You can config gitlab CI runner to create build automatically. - Step 2: Add 2 variable: - BRANCH_NAME: branch of repo want to build. ex: develop, main, ... - BASE_ENV_ARGS: env want to build. String with "," separator. This will use for fastlane. ex: dev,prod - ``` ### .gitlab-ci.yml @@ -38,13 +36,13 @@ default: - macos_shared variables: - GIT_CLEAN_FLAGS: "none" + GIT_CLEAN_FLAGS: 'none' # BRANCH_NAME: "develop" - FASTLANE_SCRIPT_ANDROID: "bundle exec fastlane android" - FASTLANE_SCRIPT_IOS: "bundle exec fastlane ios" + FASTLANE_SCRIPT_ANDROID: 'bundle exec fastlane android' + FASTLANE_SCRIPT_IOS: 'bundle exec fastlane ios' # BASE_ENV_ARGS: "dev" - EXPORT_DIR_ARGS_NAME: "export_dir" - EXPORT_FOLDER: "export/$BRANCH_NAME" + EXPORT_DIR_ARGS_NAME: 'export_dir' + EXPORT_FOLDER: 'export/$BRANCH_NAME' clone-code-project: stage: clone @@ -97,7 +95,7 @@ build-android: - fnm use $NODE_VERSION script: - echo "sdk.dir=$ANDROID_HOME" > android/local.properties - - npx ts-node build_script/build-android.ts $BASE_ENV_ARGS $EXPORT_FOLDER + - node build-ci/build-android.js $BASE_ENV_ARGS $EXPORT_FOLDER needs: - job: install-dependencies allow_failure: true @@ -108,7 +106,7 @@ deploy-android: - echo "Deploy android app ..." - cd repo/$BRANCH_NAME script: - - npx ts-node build_script/deploy-android.ts $BASE_ENV_ARGS $EXPORT_FOLDER + - node build-ci/deploy-android.js $BASE_ENV_ARGS $EXPORT_FOLDER needs: - job: build-android allow_failure: true @@ -120,7 +118,7 @@ build-ios: - cd repo/$BRANCH_NAME - fnm use $NODE_VERSION script: - - npx ts-node build_script/build-ios.ts $BASE_ENV_ARGS $EXPORT_FOLDER + - node build-ci/build-ios.js $BASE_ENV_ARGS $EXPORT_FOLDER needs: - job: install-dependencies allow_failure: true @@ -131,7 +129,7 @@ deploy-ios: - echo "Deploy ios app ..." - cd repo/$BRANCH_NAME script: - - npx ts-node build_script/deploy-ios.ts $BASE_ENV_ARGS $EXPORT_FOLDER + - node build-ci/deploy-ios.js $BASE_ENV_ARGS $EXPORT_FOLDER needs: - job: build-ios allow_failure: true @@ -154,7 +152,6 @@ clean-up: script: - rm -rf $BRANCH_NAME needs: [release, deploy-ios, deploy-android] - ``` ### pull_repo.sh @@ -168,9 +165,9 @@ mkdir -p repo/$branch cd repo/$branch rm -rf fastlane git clone $repo -b $branch . -# copy fastlane and build_script to $branch folder +# copy fastlane and build-ci to $branch folder cp -r ../../fastlane . -cp -r ../../build_script . +cp -r ../../build-ci . ``` @@ -203,9 +200,9 @@ done ### build-ci -#### build-android.ts +#### build-android.js -```ts +```js import { execSync } from 'child_process'; (() => { @@ -231,12 +228,11 @@ import { execSync } from 'child_process'; ); }); })(); - ``` -#### deploy-android.ts +#### deploy-android.js -```ts +```js import { execSync } from 'child_process'; (() => { @@ -255,12 +251,11 @@ import { execSync } from 'child_process'; ); }); })(); - ``` -#### build-ios.ts +#### build-ios.js -```ts +```js import { execSync } from 'child_process'; (() => { @@ -279,12 +274,11 @@ import { execSync } from 'child_process'; ); }); })(); - ``` -#### deploy-ios.ts +#### deploy-ios.js -```ts +```js import { execSync } from 'child_process'; (() => { @@ -303,19 +297,18 @@ import { execSync } from 'child_process'; ); }); })(); - ``` > Folder structure like: . - ├── fastlane - ├── build-ci - │ ├── build-android.ts - │ ├── deploy-android.ts - │ ├── build-ios.ts - │ └── deploy-ios.ts - ├── .gitlab-ci.yml - ├── pull_repo.sh - ├── release.sh + ├── fastlane + ├── build-ci + │ ├── build-android.js + │ ├── deploy-android.js + │ ├── build-ios.js + │ └── deploy-ios.js + ├── .gitlab-ci.yml + ├── pull_repo.sh + ├── release.sh └── README.md diff --git a/template/ios/HelloWorld.xcodeproj/project.pbxproj b/template/ios/HelloWorld.xcodeproj/project.pbxproj index 4061360..7bab12b 100644 --- a/template/ios/HelloWorld.xcodeproj/project.pbxproj +++ b/template/ios/HelloWorld.xcodeproj/project.pbxproj @@ -349,6 +349,7 @@ baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-HelloWorld.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSETCATALOG_COMPILER_APPICON_NAME)"; + CODE_SIGN_STYLE = Manual; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = "$(APPLE_DEVELOPMENT_TEAM)"; @@ -385,6 +386,7 @@ baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-HelloWorld.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSETCATALOG_COMPILER_APPICON_NAME)"; + CODE_SIGN_STYLE = Manual; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = "$(APPLE_DEVELOPMENT_TEAM)"; diff --git a/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld-Dev.xcscheme b/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld-Dev.xcscheme index 45a3b87..ea57112 100644 --- a/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld-Dev.xcscheme +++ b/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld-Dev.xcscheme @@ -49,7 +49,7 @@ diff --git a/template/package.json b/template/package.json index fd8db9c..1a3e3bb 100644 --- a/template/package.json +++ b/template/package.json @@ -9,8 +9,8 @@ "format": "prettier --write **/*.{ts,tsx,js,json,md}", "splash": "node ./scripts/splash.js assets/splash/splash.png FFFFFF 150 main BootSplash", "type:check": "yarn tsc --noEmit --skipLibCheck", - "app-icon": "npx rn-ml appicon -s assets/appicon/appicon.png", - "app-icon:dev": "npx rn-ml appicon -s assets/appicon/appicon-dev.png -f dev -icn AppIcon-Dev", + "app-icon": "npx -y rn-ml appicon -s assets/appicon/appicon.png", + "app-icon:dev": "npx -y rn-ml appicon -s assets/appicon/appicon-dev.png -f dev -icn AppIcon-Dev", "ios:notification:dev": "node ./scripts/ios.js push-notification env/dev.json ", "android:report": "node scripts/android.js report", "android:hash": "node scripts/android.js hash", diff --git a/template/scripts/splash.js b/template/scripts/splash.js index d8a0693..58119a0 100644 --- a/template/scripts/splash.js +++ b/template/scripts/splash.js @@ -3,7 +3,7 @@ /* eslint-disable @typescript-eslint/no-var-requires */ const { execSync } = require('child_process'); -const { readFileSync, rmSync, writeFileSync } = require('fs'); +const { readFileSync, rmSync, writeFileSync, copyFileSync } = require('fs'); const { resolve } = require('path'); (function () { @@ -61,7 +61,7 @@ const { resolve } = require('path'); 'utf8', ); - execSync(`mv -f ${oldBootSplashPath} ${newBootSplashPath}`); + copyFileSync(oldBootSplashPath, newBootSplashPath); if (oldBootSplashLogoPath !== newBootSplashLogoPath) { execSync(`mv -f ${oldBootSplashLogoPath} ${newBootSplashLogoPath}`);