Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions .github/workflows/react-native-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,35 @@ jobs:
- name: 📋 Create Google Json File
if: ${{ matrix.platform == 'android' }}
run: |
echo $UNIT_GOOGLE_SERVICES | base64 -d > google-services.json
printf '%s' "$UNIT_GOOGLE_SERVICES" | base64 -d > google-services.json

# Keystore is decoded OUTSIDE the project root so it can never be picked up
# by the EAS build archive or any artifact globs; credentials.json points to
# it via an absolute path (supported by EAS for local credentials).
- name: 📋 Create Android Keystore
if: ${{ matrix.platform == 'android' }}
run: |
printf '%s' "$UNIT_ANDROID_KS" | base64 -d > "$RUNNER_TEMP/keystore.jks"
chmod 600 "$RUNNER_TEMP/keystore.jks"

- name: 📋 Ensure jq exists
if: ${{ matrix.platform == 'android' }}
run: |
if ! command -v jq >/dev/null 2>&1; then
echo "Installing jq..."
sudo apt-get update && sudo apt-get install -y jq

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules high

External command failure handling is missing in .github/workflows/react-native-cicd.yml for apt-get update and apt-get install -y jq, so package-manager errors can fail without contextual diagnostics. Add explicit handling around these external calls so the workflow emits a clear failure message and exits deterministically.

Kody rule violation: Add try-catch blocks for external calls

try_command() {
  "$@"
}

if ! command -v jq >/dev/null 2>&1; then
  echo "Installing jq..."
  set -e
  if ! sudo apt-get update || ! sudo apt-get install -y jq; then
    echo "Failed to install jq" >&2
    exit 1
  fi
fi
Prompt for LLM

File .github/workflows/react-native-cicd.yml:

Line 212:

External command failure handling is missing in .github/workflows/react-native-cicd.yml for `apt-get update` and `apt-get install -y jq`, so package-manager errors can fail without contextual diagnostics. Add explicit handling around these external calls so the workflow emits a clear failure message and exits deterministically.

Suggested Code:

            try_command() {
              "$@"
            }

            if ! command -v jq >/dev/null 2>&1; then
              echo "Installing jq..."
              set -e
              if ! sudo apt-get update || ! sudo apt-get install -y jq; then
                echo "Failed to install jq" >&2
                exit 1
              fi
            fi

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

fi

- name: 📋 Create Credentials File
if: ${{ matrix.platform == 'android' }}
run: |
printf '%s' "$CREDENTIALS_JSON_BASE64" | base64 -d \
| jq --arg ks "$RUNNER_TEMP/keystore.jks" '.android.keystore.keystorePath = $ks' > credentials.json
Comment on lines +217 to +219

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Android build failure in .github/workflows/react-native-cicd.yml: the 📋 Create Credentials File step invokes jq before the workflow installs or verifies it, so runner images without a preinstalled jq fail when generating credentials.json at lines 209-211 while the fallback installation does not run until lines 218-230. Install jq before this step or generate the file without adding an earlier tool dependency.

- name: Ensure jq exists
  if: ${{ matrix.platform == 'android' }}
  run: |
    if ! command -v jq >/dev/null 2>&1; then
      sudo apt-get update && sudo apt-get install -y jq
    fi

- name: 📋 Create Credentials File
  if: ${{ matrix.platform == 'android' }}
  run: |
    printf '%s' "$CREDENTIALS_JSON_BASE64" | base64 -d \
      | jq --arg ks "$RUNNER_TEMP/keystore.jks" '.android.keystore.keystorePath = $ks' > credentials.json
Prompt for LLM

File .github/workflows/react-native-cicd.yml:

Line 209 to 211:

Android build failure in `.github/workflows/react-native-cicd.yml`: the `📋 Create Credentials File` step invokes `jq` before the workflow installs or verifies it, so runner images without a preinstalled `jq` fail when generating `credentials.json` at lines 209-211 while the fallback installation does not run until lines 218-230. Install `jq` before this step or generate the file without adding an earlier tool dependency.

Suggested Code:

      - name: Ensure jq exists
        if: ${{ matrix.platform == 'android' }}
        run: |
          if ! command -v jq >/dev/null 2>&1; then
            sudo apt-get update && sudo apt-get install -y jq
          fi

      - name: 📋 Create Credentials File
        if: ${{ matrix.platform == 'android' }}
        run: |
          printf '%s' "$CREDENTIALS_JSON_BASE64" | base64 -d \
            | jq --arg ks "$RUNNER_TEMP/keystore.jks" '.android.keystore.keystorePath = $ks' > credentials.json

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.


- name: 📋 Create Google Json File for iOS
if: ${{ matrix.platform == 'ios' }}
run: |
echo $UNIT_IOS_GOOGLE_SERVICES | base64 -d > GoogleService-Info.plist
printf '%s' "$UNIT_IOS_GOOGLE_SERVICES" | base64 -d > GoogleService-Info.plist

- name: 📋 Update package.json Versions
run: |
Expand Down Expand Up @@ -243,16 +266,17 @@ jobs:
eas --version

- name: 📋 Create iOS Cert
if: ${{ matrix.platform == 'ios' }}
run: |
echo $UNIT_IOS_CERT | base64 -d > AuthKey_HRBP5FNJN6.p8
printf '%s' "$UNIT_IOS_CERT" | base64 -d > AuthKey_HRBP5FNJN6.p8
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: 📋 Restore gradle.properties
env:
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
shell: bash
run: |
mkdir -p ~/.gradle/
echo ${GRADLE_PROPERTIES} > ~/.gradle/gradle.properties
printf '%s\n' "$GRADLE_PROPERTIES" > ~/.gradle/gradle.properties

- name: 📱 Build Development APK
if: (matrix.platform == 'android' && (github.event.inputs.buildType == 'all' || github.event_name == 'push' || github.event.inputs.buildType == 'dev'))
Expand All @@ -275,7 +299,7 @@ jobs:
if: (matrix.platform == 'android' && (github.event.inputs.buildType == 'all' || github.event_name == 'push' || github.event.inputs.buildType == 'prod-aab'))
run: |
export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096"
eas build --platform android --profile production --local --non-interactive --output=./ResgridUnit-prod.aab
eas build --platform android --profile production-aab --local --non-interactive --output=./ResgridUnit-prod.aab
env:
NODE_ENV: production

Expand Down Expand Up @@ -303,6 +327,10 @@ jobs:
env:
NODE_ENV: production

- name: 🧹 Remove signing materials
if: always()
run: rm -f credentials.json AuthKey_HRBP5FNJN6.p8 "$RUNNER_TEMP/keystore.jks" ~/.gradle/gradle.properties

Comment thread
coderabbitai[bot] marked this conversation as resolved.
- name: 📦 Upload build artifacts to GitHub
uses: actions/upload-artifact@v4
with:
Expand Down
5 changes: 5 additions & 0 deletions eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
"FLIPPER_DISABLE": "1"
}
},
"production-aab": {
"extends": "production",
"credentialsSource": "local"
},
"production-apk": {
"distribution": "store",
"credentialsSource": "local",
"yarn": "1.22.22",
"ios": {
"image": "latest"
Expand Down
Loading