How can I access local.properties in Github Action yml file for ci?

735 Views Asked by At

I get data from local.properties in build.gradle like this.

android {
    signingConfigs {
        debug {
            Properties properties = new Properties()
            properties.load(project.rootProject.file('local.properties').newDataInputStream())
            storeFile file(properties.getProperty('SIGNED_STORE_FILE'))
            storePassword properties.getProperty('SIGNED_STORE_PASSWORD')
            keyAlias properties.getProperty('SIGNED_KEY_ALIAS')
            keyPassword properties.getProperty('SIGNED_KEY_PASSWORD')
        }
    }
    compileSdk 31
...
}

And local.properties looks like this:

## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Mon Dec 06 11:17:36 KST 2021
sdk.dir=/Users/me/Library/Android/sdk

SIGNED_STORE_FILE=../../jks/my_proejct_jks
SIGNED_STORE_PASSWORD=12345
SIGNED_KEY_ALIAS=myproject
SIGNED_KEY_PASSWORD=12345

I made android-ci.yml file like this:

name: Android CI

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Setup JDK 11
        uses: actions/setup-java@v3
        with:
          distribution: "zulu"
          java-version: 11

      - name: Setup Android SDK
        uses: android-actions/setup-android@v2

      - name: Cache Gradle packages
        uses: actions/cache@v3
        with:
          path: |
            ~/.gradle/caches
            ~/.gradle/wrapper
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
          restore-keys: |
            ${{ runner.os }}-gradle-

      - name: Grant execute permission for gradlew
        run: chmod +x gradlew

      - name: Check ktlint format
        run: ./gradlew ktlintCheck

      - name: Fix ktlint format
        run: ./gradlew ktlintFormat

      - name: Fix detekt
        run: ./gradlew detekt

      - name: Build assemble release apk
        run: ./gradlew assembleRelease

And I got this error.

enter image description here

How can I solve this problem?

0

There are 0 best solutions below