Skip to content

Commit

Permalink
test94
Browse files Browse the repository at this point in the history
  • Loading branch information
iZakirSheikh committed Aug 23, 2023
1 parent 4b9041d commit c739e5f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 45 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
- name: Setting environment variables for date, ads, unity, and version
run: >
echo "DATE_TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
echo "IAP_NO_ADS=$(echo ${{ secrets.IAP_NO_ADS }})" >> $GITHUB_ENV
echo "PLACEMENT_BANNER_1=$(echo ${{ secrets.PLACEMENT_BANNER_1 }})" >> $GITHUB_ENV
echo "PLACEMENT_BANNER_1=$(echo ${{ secrets.PLACEMENT_BANNER_1 }})" >> $GITHUB_ENV
echo "PLACEMENT_BANNER_2=$(echo ${{ secrets.PLACEMENT_BANNER_2 }})" >> $GITHUB_ENV
echo "PLACEMENT_INTERSTITIAL=$(echo ${{ secrets.PLACEMENT_INTERSTITIAL }})" >> $GITHUB_ENV
echo "PLAY_CONSOLE_APP_RSA_KEY=$(echo ${{ secrets.PLAY_CONSOLE_APP_RSA_KEY }})" >> $GITHUB_ENV
echo "UNITY_APP_ID=$(echo ${{ secrets.UNITY_APP_ID }})" >> $GITHUB_ENV
echo "GIT_TAG=$(grep -E "versionName\s*=?\s*['\"]" "app/build.gradle.kts" | awk -F"['\"]" '{print $2}')" >> $GITHUB_ENV
echo "IAP_NO_ADS=${{ secrets.IAP_NO_ADS }}" >> local.properties
echo "PLACEMENT_BANNER_1=${{ secrets.PLACEMENT_BANNER_1 }}" >> local.properties
echo "PLACEMENT_BANNER_2=${{ secrets.PLACEMENT_BANNER_2 }}" >> local.properties
echo "PLACEMENT_INTERSTITIAL=${{ secrets.PLACEMENT_INTERSTITIAL }}" >> local.properties
echo "PLAY_CONSOLE_APP_RSA_KEY=${{ secrets.PLAY_CONSOLE_APP_RSA_KEY }}" >> local.properties
echo "UNITY_APP_ID=${{ secrets.UNITY_APP_ID }}" >> local.properties
- name: Configuring Java environment with Zulu JDK 17 and Gradle cache,
uses: actions/setup-java@v3
with:
Expand Down
60 changes: 22 additions & 38 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.android.build.api.dsl.ApplicationDefaultConfig
import java.util.Properties

plugins {
alias(libs.plugins.androidApplication)
Expand All @@ -21,9 +22,8 @@ android {
versionName = "1.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { useSupportLibrary = true }
// Add necessary const to BuildConfig
// These filed will be provided in github
// secrets when released else defualt value will be used
// Load secret keys from properties of Local Config.
// The local properties must be prefixed with secret.
secrets()
}
buildTypes {
Expand Down Expand Up @@ -131,39 +131,23 @@ dependencies {
* Init adn add git secrets to BuildConfig
*/
fun ApplicationDefaultConfig.secrets() {
buildConfigField(
"String",
"IAP_BUY_ME_COFFEE",
"\"" + (System.getenv("IAP_BUY_ME_COFFEE") ?: "empty") + "\""
)
buildConfigField(
"String",
"IAP_NO_ADS",
"\"" + (System.getenv("IAP_NO_ADS") ?: "empty") + "\""
)
buildConfigField(
"String",
"PLACEMENT_BANNER_1",
"\"" + (System.getenv("PLACEMENT_BANNER_1") ?: "empty") + "\""
)
buildConfigField(
"String",
"PLACEMENT_BANNER_2",
"\"" + (System.getenv("PLACEMENT_BANNER_2") ?: "empty") + "\""
)
buildConfigField(
"String",
"PLACEMENT_INTERSTITIAL",
"\"" + (System.getenv("PLACEMENT_INTERSTITIAL") ?: "empty") + "\""
)
buildConfigField(
"String",
"UNITY_APP_ID",
"\"" + (System.getenv("UNITY_APP_ID") ?: "empty") + "\""
)
buildConfigField(
"String",
"PLAY_CONSOLE_APP_RSA_KEY",
"\"" + (System.getenv("PLAY_CONSOLE_APP_RSA_KEY") ?: "empty") + "\""
)
val properties = Properties().apply {
load(project.rootProject.file("local.properties").inputStream())
}
var value = "\"" + properties.getProperty("IAP_BUY_ME_COFFEE", "empty") + "\""
buildConfigField("String", "IAP_BUY_ME_COFFEE", value)
value = "\"" + properties.getProperty("IAP_NO_ADS", "empty") + "\""
buildConfigField("String", "IAP_NO_ADS", value)
value = "\"" + properties.getProperty("PLACEMENT_BANNER_1", "empty") + "\""
buildConfigField("String", "PLACEMENT_BANNER_1", value)
value = "\"" + properties.getProperty("PLACEMENT_BANNER_1", "empty") + "\""
buildConfigField("String", "PLACEMENT_BANNER_2", value)
value = "\"" + properties.getProperty("PLACEMENT_BANNER_2", "empty") + "\""
buildConfigField("String", "PLACEMENT_INTERSTITIAL", value)
value = "\"" + properties.getProperty("PLACEMENT_INTERSTITIAL", "empty") + "\""
buildConfigField("String", "PLACEMENT_BANNER_1", value)
value = "\"" + properties.getProperty("UNITY_APP_ID", "empty") + "\""
buildConfigField("String", "UNITY_APP_ID", value)
value = "\"" + properties.getProperty("PLAY_CONSOLE_APP_RSA_KEY", "empty") + "\""
buildConfigField("String", "PLAY_CONSOLE_APP_RSA_KEY", value)
}

0 comments on commit c739e5f

Please sign in to comment.