Skip to content

Commit

Permalink
added github scret variables
Browse files Browse the repository at this point in the history
  • Loading branch information
lucienshema committed Nov 14, 2024
1 parent 33ecbf2 commit addb49d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
name: Android CI

env:
# Main module of the project
main_project_module: app

# Developer's name
dev_name: Lucien Shema

on:
push:
branches:
- main
- dev

# Allows manual workflow runs from the Actions tab
workflow_dispatch:

jobs:
Expand All @@ -37,7 +32,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt' # Available distributions can be found in the action's documentation
distribution: 'adopt'
java-version: '21.0.4+7.0.LTS'

# Set up Gradle with caching for dependencies
Expand All @@ -47,6 +42,12 @@ jobs:
gradle-version: 8.10.2
distribution-url: "https://services.gradle.org/distributions/gradle-8.10.2-bin.zip"

# Inject secrets as environment variables
- name: Inject secret variables
run: |
echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}" >> $GITHUB_ENV
echo "BASE_URL=${{ secrets.BASE_URL }}" >> $GITHUB_ENV
# Change Gradle wrapper permissions
- name: Change Gradle wrapper permissions
run: chmod +x ./gradlew
Expand All @@ -59,14 +60,6 @@ jobs:
./gradlew wrapper
fi
- name: Download gradle-wrapper.jar if missing
run: |
if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then
mkdir -p ./gradle/wrapper
curl -L -o ./gradle/wrapper/gradle-wrapper.jar https://services.gradle.org/distributions/gradle-wrapper-8.10.2.jar
fi
# Build the project
- name: Build Gradle project
run: ./gradlew build
Expand All @@ -79,6 +72,7 @@ jobs:




# # Create APK Debug
# - name: Build apk debug project (APK)-${{ env.main_project_module }} module
# run: ./gradlew assembleDebug
Expand Down
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ plugins {
id 'kotlin-parcelize'
}


def googleMapsApiKey = System.getenv("GOOGLE_MAPS_API_KEY") ?: ""
def baseUrl = System.getenv("BASE_URL") ?: ""

android {
namespace 'org.technoserve.farmcollector'
compileSdk 34
Expand All @@ -21,6 +25,8 @@ android {
vectorDrawables {
useSupportLibrary true
}
buildConfigField "String", "GOOGLE_MAPS_API_KEY", "\"${googleMapsApiKey}\""
buildConfigField "String", "BASE_URL", "\"${baseUrl}\""
}

buildTypes {
Expand Down

0 comments on commit addb49d

Please sign in to comment.