-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (94 loc) · 4.75 KB
/
Copy pathdebug_config.yml
File metadata and controls
113 lines (94 loc) · 4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Debug Android Build Config Setup
on:
# push:
# branches:
# - main # Or your dedicated debug branch
workflow_dispatch: # Allows manual triggering
jobs:
debug_config:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Show Current Working Directory
run: pwd
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install JavaScript dependencies
run: npm install
# - name: Setup Expo CLI
# run: npm install -g expo-cli
# Step 1: Run expo prebuild (This cleans and generates native files)
- name: Generate Android project files (expo prebuild)
run: npx expo prebuild --clean --platform android --non-interactive
- name: Debug - Verify android/app after prebuild
run: |
echo "--- Listing contents of android/app/ after prebuild ---"
ls -l android/app/
echo "--- First few lines of android/app/build.gradle after prebuild ---"
head -n 20 android/app/build.gradle
echo "------------------------------------------------------------------"
# New Step: Run expo-doctor to check project health
- name: Run Expo Doctor
run: npx expo-doctor
# Step 2: APPEND to android/gradle.properties, not overwrite
- name: Append to gradle.properties
run: |
mkdir -p android # Ensure the directory exists
echo "" >> android/gradle.properties # Add an empty line for separation
echo "# Signing properties added by GitHub Actions" >> android/gradle.properties
echo "MYAPP_UPLOAD_STORE_FILE=my-release-key.keystore" >> android/gradle.properties
echo "MYAPP_UPLOAD_KEY_ALIAS=${{ secrets.MYAPP_UPLOAD_KEY_ALIAS }}" >> android/gradle.properties
echo "MYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}" >> android/gradle.properties
echo "MYAPP_UPLOAD_KEY_PASSWORD=${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}" >> android/gradle.properties
- name: Debug - Verify gradle.properties Content (CAUTION Contains secrets)
run: |
echo "--- Contents of android/gradle.properties ---" # IMPORTANT: Now checking android/gradle.properties
cat android/gradle.properties
echo "-------------------------------------------------"
# Step 3: Create Keystore file (NOW runs AFTER prebuild, into android/app/)
- name: Create Keystore file
env:
MYAPP_UPLOAD_KEYSTORE_BASE64: ${{ secrets.MYAPP_UPLOAD_KEYSTORE_BASE64 }}
run: |
mkdir -p android/app # Ensure the directory exists within the newly generated project
echo "$MYAPP_UPLOAD_KEYSTORE_BASE64" | base64 --decode > android/app/my-release-key.keystore
# Step 4: Debug - Verify Keystore File Creation (Should NOW list my-release-key.keystore)
- name: Debug - Verify Keystore File Creation
run: |
echo "--- Listing contents of android/app/ ---"
ls -l android/app/
echo "--- Checking size of my-release-key.keystore ---"
du -h android/app/my-release-key.keystore
# Step 5: Run Node.js script to modify build.gradle (Path in script should be android/app/build.gradle)
- name: Run Node.js script to modify build.gradle
run: node scripts/Step6Fix.js
# Step 6: Debug - Display Modified build.gradle Content
- name: Debug - Display Modified build.gradle Content (CAUTION!)
run: |
echo "--- Contents of android/app/build.gradle after Node.js script ---"
cat android/app/build.gradle
echo "------------------------------------------------------------------"
- name: Build Release APK
run: |
echo "Starting Android Release APK build (with clean)..."
cd android # Change directory to the android project root
./gradlew clean assembleRelease # Command to clean and then build the release APK
echo "Android Release APK build finished."
echo "Listing generated APKs:"
ls -l app/build/outputs/apk/release/ # List the output directory to find the APK
echo "-----------------------------------"
- name: Upload Release APK
uses: actions/upload-artifact@v4
with:
name: myapp-release-apk # The name of the artifact, you'll see this in the workflow run summary
path: android/app/build/outputs/apk/release/*.apk # The path to your generated APK file(s)
retention-days: 5 # Optional: how long to keep the artifact (e.g., 5 days)