diff --git a/.github/workflows/develop-cicd.yml b/.github/workflows/develop-cicd.yml index a80d2a3..b7dc1cc 100644 --- a/.github/workflows/develop-cicd.yml +++ b/.github/workflows/develop-cicd.yml @@ -183,4 +183,4 @@ jobs: status: draft inAppUpdatePriority: 3 whatsNewDirectory: android/release-notes/ - releaseName: v1.0.6 + releaseName: v1.0.10 diff --git a/.github/workflows/production-cicd.yml b/.github/workflows/production-cicd.yml new file mode 100644 index 0000000..1665ab9 --- /dev/null +++ b/.github/workflows/production-cicd.yml @@ -0,0 +1,190 @@ +name: Production CI/CD + +on: + pull_request: + branches: + - main + paths-ignore: + - '**/*.md' + - '**/*.yml' + - '**/*.gradle' + - '**/*.txt' + - '.gitignore' + - '.gitattributes' + types: + - closed + +jobs: + test: + # only run workflow after PR is merged + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Checkout branch + uses: actions/checkout@v3 + + # Cache npm dependencies (from GitHub docs) + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + # If there's a cache miss + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + # Caching process complete + + - name: Install dependencies + run: npm install + + - name: Lint check + run: npm run lint + + - name: Run tests + run: npm run test + + deploy: + needs: test + # default action is success(): if(success) + runs-on: ubuntu-latest + env: + MYAPP_UPLOAD_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_ALIAS }} + MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }} + MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }} + + steps: + # We need to checkout the current branch and install node + # dependencies again because every GH Actions job runs on + # a seperate runner (VM) + - name: Checkout branch + uses: actions/checkout@v3 + + # Cache npm dependencies (from GitHub docs) + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + # If there's a cache miss + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + # Caching process complete + + - name: Install dependencies + run: npm install + + - name: Increment versionCode + id: increment_version + run: | + # Extract the current versionCode from build.gradle + current_version_code=$(grep 'versionCode' android/app/build.gradle | awk -F ' ' '{print $2}') + + # Increment the versionCode by 1 + new_version_code=$((current_version_code + 1)) + + # Update the build.gradle file with the new versionCode + sed -i "s/versionCode ${current_version_code}/versionCode ${new_version_code}/" android/app/build.gradle + + echo "NEW_VERSION_CODE=${new_version_code}" >> ${GITHUB_OUTPUT} + + - name: Cache Gradle Wrapper + uses: actions/cache@v3 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + - name: Cache Gradle Dependencies + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-gradle-caches- + + # Start the build process + - name: Make Gradlew Executable + run: cd android && chmod +x ./gradlew + + # - name: Generate App APK + # run: | + # cd android && ./gradlew assembleRelease --no-daemon + + # - name: Sign generated APK + # id: sign_app + # uses: r0adkll/sign-android-release@v1 + # with: + # releaseDirectory: android/app/build/outputs/apk/release + # signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }} + # alias: ${{ secrets.ANDROID_SIGNING_ALIAS }} + # keyStorePassword: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }} + # keyPassword: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }} + + # - name: Check app directory after signing (debug) + # run: | + # ls -a android/app/build/outputs/apk/release + + - name: Build Android App Bundle + run: cd android && ./gradlew bundleRelease --no-daemon + + - name: Sign App Bundle + id: sign_app + uses: r0adkll/sign-android-release@v1 + with: + releaseDirectory: android/app/build/outputs/bundle/release + signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }} + alias: ${{ secrets.ANDROID_SIGNING_ALIAS }} + keyStorePassword: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }} + keyPassword: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }} + + # ## Distribute app to Firebase App Distribution for testing + # ## Use google play internal track if you have a google play account + # ## (uncomment the sections below if you want to use Play Store) + # - name: Upload artifact to Firebase App Distribution + # uses: wzieba/Firebase-Distribution-Github-Action@v1 + # with: + # appId: ${{secrets.ANDROID_FIREBASE_APP_ID}} + # token: ${{secrets.ANDROID_FIREBASE_TOKEN}} + # groups: testers + # file: ${{steps.sign_app.outputs.signedReleaseFile}} + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: Signed App Bundle + path: ${{steps.sign_app.outputs.signedReleaseFile}} + + - name: Deploy to Play Store (Alpha) + uses: r0adkll/upload-google-play@v1 + with: + serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT }} + # The packageName must already exist in the play console account, so make sure you upload a manual apk or aab first through the console + # https://github.com/r0adkll/upload-google-play/tree/v1/ + packageName: com.thebest.gamchha + releaseFiles: ${{steps.sign_app.outputs.signedReleaseFile}} + track: production + status: draft + inAppUpdatePriority: 3 + whatsNewDirectory: android/release-notes/ + releaseName: v1.0.0.p diff --git a/App.tsx b/App.tsx index 72c4f0b..df98ac1 100644 --- a/App.tsx +++ b/App.tsx @@ -68,8 +68,8 @@ const styles = StyleSheet.create({ highlight: { fontSize: 24, fontWeight: '700', - // color: 'blue', - color: 'red', + color: 'blue', + // color: 'red', }, }); diff --git a/android/app/build.gradle b/android/app/build.gradle index efad635..0f99f83 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -79,8 +79,8 @@ android { applicationId "com.thebest.gamchha" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 10 - versionName "1.0.10" + versionCode 11 + versionName "1.0.11" } signingConfigs { debug {