Skip to content

Commit

Permalink
I have worked on:
Browse files Browse the repository at this point in the history
- Updated workflows
- Added BuildConfig api key support for cicd
  • Loading branch information
AliAzaz committed Sep 20, 2023
1 parent 858d8cf commit bb122a8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/dispatch_git_artifact_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ jobs:
- name: Grant Permission to Execute
run: chmod +x gradlew

- name: Upload API Key to gradle properties 🔥
run: sed -i "s|PIXABAY_KEY|${{secrets.PIXABAY_KEY}}|g" ./gradle.properties


#Generate an apk
build-apk:
needs: app-utils-creation
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual_dispatch_app_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Get archivesBaseName
id: apk-name
run: echo "APK_NAME=app--${{env.APP_TYPE}}.apk" >> $GITHUB_OUTPUT
run: echo "APK_NAME=app-${{env.APP_TYPE}}.apk" >> $GITHUB_OUTPUT

build-apk:
needs: app-utils-creation
Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ android {
versionCode ConfigurationData.versionCode
versionName ConfigurationData.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

buildConfigField("String", "PIXABAY_KEY", PIXABAY_KEY)
}

signingConfigs {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.pixabaygalleryapp.di.modules

import com.example.pixabaygalleryapp.BuildConfig
import com.example.pixabaygalleryapp.di.auth.AuthApi
import com.example.pixabaygalleryapp.utils.CONSTANTS
import com.example.pixabaygalleryapp.utils.CONSTANTS.BASE_URL
Expand Down Expand Up @@ -69,7 +70,7 @@ class NetworkApiModule {
return Interceptor { chain ->
chain.request().let {
val urlBuilder = it.url.newBuilder()
.addQueryParameter(CONSTANTS.KEY, Keys.apiKey())
.addQueryParameter(CONSTANTS.KEY, Keys.apiKey() ?: BuildConfig.PIXABAY_KEY)
.build()
chain.proceed(it.newBuilder().url(urlBuilder).build())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ object Keys {
System.loadLibrary("native-lib")
}

external fun apiKey(): String
external fun apiKey(): String?
}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.code.style=official
#For CICD build genearation
PIXABAY_KEY="PIXABAY_KEY"

0 comments on commit bb122a8

Please sign in to comment.