How can I get version name in circle.yml with Android?

How can I get version name in circle.yml with Android?
I have to get version name to publish github release.

Hi there,

Welcome to our community!

I am not quite sure what you mean by version name. Could you please clarify?

Hi, thanks for your reply.

In build.gradle has versionName. I want to get verionName in config.yml of CircleCI.

You could read the config.yml file with a YAML parser. There are sure to be console tools and language libraries available. I use PHP, so when I need to parse YAML, I use Symfony/YAML.

I would put the versionName in an env var like this:

version: 2.1
jobs:
  build:
    environment:
      ANDROID_VERSION_NAME: kitkat
    steps:
      - checkout
      - run: ./gradlew test

and then read the value it in build.grade using something like System.getenv("ANDROID_VERSION_NAME") when you need to use it.

Marc

1 Like