我正在尝试自动化 android 应用程序的构建过程,我已将 baseUrl 存储在 local.properties 文件中,并通过 Github 机密传递文件内容,但 Github 操作一直失败,
构建.gradle:
def propFile=rootProject.file("./local.properties")
def properties = new Properties()
properties.load(new FileInputStream(propFile))
def baseUrl = properties['BASEURL']
//getProperty("BASEURL", "")
debug {
buildConfigField 'String', "BASEURL", baseUrl
resValue 'string', "base_url", baseUrl
}
YML:
name: Android CI
on:
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Decode BASEURL
env:
BASEURL: ${{ secrets.BASEURL }}
run: echo BASEURL="$BASEURL" > ./local.properties
- name: Clean
run: ./gradlew clean
- name: Build with Gradle
run: ./gradlew build
我如何通过 Github 秘密传递 BASEURL
这是 Github 操作控制台的日志输出