diff --git a/.github/workflows/build-debug.yml b/.github/workflows/build-debug.yml new file mode 100644 index 0000000..e368b72 --- /dev/null +++ b/.github/workflows/build-debug.yml @@ -0,0 +1,37 @@ +name: Build and Upload Debug APK + +on: + push: + branches: + - main + - beta + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: "8.7" + + - name: Clean project + run: ./gradlew clean + + - name: Build Debug Bundle + run: ./gradlew buildDevDebugPreBundle + + - name: Zip APK for Debug + run: ./gradlew zipApkForDebug + + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + path: app/build/outputs/apk/dev/debug/OGStarTrackerApp-dev-debug.apk diff --git a/.gitignore b/.gitignore index db80f94..24e6729 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ app/dev/release/baselineProfiles app/dev/release app/ogstartracker.keystore app/prod.keystore +android diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..b1b76fc --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Clean", + "type": "shell", + "command": "./gradlew clean", + "group": "build", + "problemMatcher": [] + }, + { + "label": "Build", + "type": "shell", + "command": "./gradlew buildDevDebugPreBundle", + "group": "build", + "dependsOn": "Clean", + "problemMatcher": [] + }, + { + "label": "Zip APK for Debug", + "type": "shell", + "command": "./gradlew zipApkForDebug", + "group": "build", + "dependsOn": "Build", + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index a9aa68e..ea2b35f 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,27 @@ The OG Star Tracker app is designed to assist astrophotographers in setting up t * **Moshi** - parsing json * **Timber** - logging +## Build setup + +To prepare your environment to build the app locally you can use your IDE of choice. This guide walks you through the building of the app with the Visual Studio Code IDE. +Extensions you need: +- [Gradle for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle) +- [Kotlin Language](https://marketplace.visualstudio.com/items?itemName=mathiasfrohlich.Kotlin) + +What you need now is the android sdk. For that we are not required to use the android studio at all and only require the cli tools. +- Download the [cli-tools for windows](https://developer.android.com/studio?hl=de#command-line-tools-only) +- Extract them into **android/cmdline-tools/tools** +- Install the dependencies and the sdk with the sdkmanager +```shell +OG-star-tracker-App\android\cmdline-tools\tools\bin> .\sdkmanager.bat "platform-tools" +OG-star-tracker-App\android\cmdline-tools\tools\bin> .\sdkmanager.bat "platforms;android-34" +OG-star-tracker-App\android\cmdline-tools\tools\bin> .\sdkmanager.bat "build-tools;34.0.0" +``` +- Configure the **$ANDROID_HOME** variable in your PATH or alternatively set the **sdk.dir=android** in your **local.properties**. +- Now reload the window and and let the gradle extension configure the project. +- Once the **OG Star Tracker** project is configured you can check the **Tasks/other** directive and execute the **zipApksForDevDebug** to finally build the App. + + ## Contributing to the OG Star Tracker App We welcome contributions from the community! If you're looking to contribute to the OG Star Tracker app, here's how you can do so: diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6a9a08a..376a953 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -67,6 +67,15 @@ android { buildConfigField("String", "TRACKER_URL", "\"http://www.tracker.com\"") } } + + applicationVariants.all { + outputs.all { + val outputImpl = this as com.android.build.gradle.internal.api.BaseVariantOutputImpl + val variantName = name + val newApkName = "OGStarTrackerApp-${variantName}.apk" + outputImpl.outputFileName = newApkName + } + } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 diff --git a/gradle.properties b/gradle.properties index 20e2a01..a371efe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,4 +20,7 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true + +# Disable sdk download +android.builder.sdkDownload=false