我正在尝试运行sed
命令来替换指示当前构建 ID 的环境变量。根据文档CIRCLE_BUILD_NUM包含我正在寻找的值,根据这个例子,它应该非常容易在command
.
下面是配置文件,下面是正在执行命令的bundle.gradle
文件,下面是结果。sed
如您所见,该sed
命令只是CIRCLE_BUILD_NUM
将其视为字符串而不是获取内部版本号。
配置.yml
version: 2.1
orbs:
android: circleci/android@0.2.0
jobs:
build:
executor: android/android
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: testing env vars
command: sed 's/${BUILD_NUM_1}/${CIRCLE_BUILD_NUM}/g' -i build.gradle
捆绑包.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def buildNum = ${BUILD_NUM_1}
输出
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def buildNum = ${CIRCLE_BUILD_NUM}