From 69932d23c15bda2c47794f4dbcad6c7c478711c5 Mon Sep 17 00:00:00 2001 From: Aran Roig Date: Wed, 22 Apr 2026 00:39:01 +0200 Subject: [PATCH] First try CI/CD --- apk/.gitea/workflows/build-apk.yml | 53 +++++++++++++++++++++++++++ apk/app.json | 12 +++++- apk/build.sh | 59 ++++++++++++++++++++++++++++++ apk/package-lock.json | 36 ------------------ apk/package.json | 4 +- 5 files changed, 124 insertions(+), 40 deletions(-) create mode 100644 apk/.gitea/workflows/build-apk.yml create mode 100755 apk/build.sh diff --git a/apk/.gitea/workflows/build-apk.yml b/apk/.gitea/workflows/build-apk.yml new file mode 100644 index 0000000..2263cc9 --- /dev/null +++ b/apk/.gitea/workflows/build-apk.yml @@ -0,0 +1,53 @@ +name: Build APK + +on: + push: + branches: [ main ] + +jobs: + build: + runs-on: docker + + steps: + - name: 📥 Checkout + uses: actions/checkout@v4 + + - name: 🟢 Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: 📦 Install deps + run: npm install + + - name: ☕ Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: 🤖 Setup Android SDK + run: | + mkdir -p $HOME/android + echo "y" | sdkmanager --licenses || true + sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.0" + + - name: 🔧 Set env + run: | + echo "ANDROID_HOME=$HOME/android" >> $GITHUB_ENV + echo "ANDROID_SDK_ROOT=$HOME/android" >> $GITHUB_ENV + echo "$HOME/android/platform-tools" >> $GITHUB_PATH + + - name: ⚙️ Expo prebuild + run: npx expo prebuild --non-interactive + + - name: 🏗️ Build APK + run: | + cd android + ./gradlew assembleRelease + + - name: 📦 Upload APK + uses: actions/upload-artifact@v4 + with: + name: app-release + path: android/app/build/outputs/apk/release/app-release.apk \ No newline at end of file diff --git a/apk/app.json b/apk/app.json index 1a38be9..6f42d71 100644 --- a/apk/app.json +++ b/apk/app.json @@ -9,7 +9,8 @@ "userInterfaceStyle": "automatic", "newArchEnabled": true, "ios": { - "supportsTablet": true + "supportsTablet": true, + "bundleIdentifier": "com.arandano69.Birthday" }, "android": { "permissions": [ @@ -22,7 +23,8 @@ "monochromeImage": "./assets/images/android-icon-monochrome.png" }, "edgeToEdgeEnabled": true, - "predictiveBackGestureEnabled": false + "predictiveBackGestureEnabled": false, + "package": "com.arandano69.Birthday" }, "web": { "output": "static", @@ -47,6 +49,12 @@ "experiments": { "typedRoutes": true, "reactCompiler": true + }, + "extra": { + "router": {}, + "eas": { + "projectId": "f761fcbd-46f2-4387-8282-005e44223075" + } } } } diff --git a/apk/build.sh b/apk/build.sh new file mode 100755 index 0000000..dd2bdc5 --- /dev/null +++ b/apk/build.sh @@ -0,0 +1,59 @@ +#!/bin/bash +export ANDROID_HOME=$HOME/android +export ANDROID_SDK_ROOT=$ANDROID_HOME +export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$PATH + +set -e # stop on error + +echo "🚧 Starting APK build..." + +# Step 1: Ensure native android folder exists +if [ ! -d "android" ]; then + echo "📦 Running Expo prebuild..." + npx expo prebuild +fi + +# Step 2: Go to android folder +cd android + +# Step 3: Check if keystore exists +KEYSTORE_FILE="app/my-release-key.keystore" + +if [ ! -f "$KEYSTORE_FILE" ]; then + echo "🔑 Generating keystore..." + + keytool -genkeypair -v \ + -storetype PKCS12 \ + -keystore $KEYSTORE_FILE \ + -alias my-key-alias \ + -keyalg RSA \ + -keysize 2048 \ + -validity 10000 \ + -storepass password \ + -keypass password \ + -dname "CN=Your Name, OU=Dev, O=MyApp, L=City, S=State, C=US" +fi + +# Step 4: Ensure gradle.properties has signing config +GRADLE_PROPS="gradle.properties" + +if ! grep -q "MYAPP_UPLOAD_STORE_FILE" $GRADLE_PROPS; then + echo "⚙️ Adding signing config..." + + cat <> $GRADLE_PROPS +MYAPP_UPLOAD_STORE_FILE=my-release-key.keystore +MYAPP_UPLOAD_KEY_ALIAS=my-key-alias +MYAPP_UPLOAD_STORE_PASSWORD=password +MYAPP_UPLOAD_KEY_PASSWORD=password +EOF +fi + +# Step 5: Build release APK +echo "🏗️ Building APK..." +./gradlew assembleRelease + +# Step 6: Output path +APK_PATH="app/build/outputs/apk/release/app-release.apk" + +echo "✅ Build complete!" +echo "📦 APK located at: android/$APK_PATH" \ No newline at end of file diff --git a/apk/package-lock.json b/apk/package-lock.json index 920f4b4..8effce0 100644 --- a/apk/package-lock.json +++ b/apk/package-lock.json @@ -3765,9 +3765,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3782,9 +3779,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3799,9 +3793,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3816,9 +3807,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3833,9 +3821,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3850,9 +3835,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3867,9 +3849,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3884,9 +3863,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -8680,9 +8656,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -8703,9 +8676,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -8726,9 +8696,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -8749,9 +8716,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ diff --git a/apk/package.json b/apk/package.json index 1281795..0a5e309 100644 --- a/apk/package.json +++ b/apk/package.json @@ -5,8 +5,8 @@ "scripts": { "start": "expo start", "reset-project": "node ./scripts/reset-project.js", - "android": "expo start --android", - "ios": "expo start --ios", + "android": "expo run:android", + "ios": "expo run:ios", "web": "expo start --web", "lint": "expo lint" },