Skip to content
eye

GitHub Action

Android Version Reader Action

v1.1.0 Latest version

Android Version Reader Action

eye

Android Version Reader Action

Get the version code, android version name and detailed version information

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Android Version Reader Action

uses: Devofure/version-reader-action@v1.1.0

Learn more about this action in Devofure/version-reader-action

Choose a version

Devofure/version-reader-action

Get the version code, android version name and detailed version information

For more information about Semver version format -> https://semver.org/

Simple Example:

  - name: version reader
    id: versionReader
    uses: Devofure/version-reader-action@v1.0.1 
    # Default is app/build.gradle

Or

  - name: version reader
    id: versionReader
    uses: Devofure/version-reader-action@v1.0.1
    with:
      gradlePath: app/build.gradle # Default is app/build.gradle

outputs:

  cleanVersionName
  versionName
  versionCode
  majorVersion 
  minorVersion 
  patchVersion

  prereleaseVersion
  prereleaseStage
  prereleaseBuildNumber
  
  buildMetaDataVersion
  buildMetaDataType
  buildMetaDataBuildNumber

Part of an example

jobs:
  build:
   runs-on: ubuntu-latest
   steps:

     - uses: actions/checkout@v2

     - name: version reader
       id: versionReader
       uses: Devofure/version-reader-action@v1.0.1
       
    # possible to use:
    # ${{ steps.versionReader.outputs.cleanVersionName }}
    # ${{ steps.versionReader.outputs.versionName }}
    # ${{ steps.versionReader.outputs.versionCode }}
    # ${{ steps.versionReader.outputs.majorVersion  }}
    # ${{ steps.versionReader.outputs.minorVersion  }}
    # ${{ steps.versionReader.outputs.patchVersion }}
    
    # ${{ steps.versionReader.outputs.prereleaseVersion }}
    # ${{ steps.versionReader.outputs.prereleaseStage }}
    # ${{ steps.versionReader.outputs.prereleaseBuildNumber }}
    
    # ${{ steps.versionReader.outputs.buildMetaDataVersion }}
    # ${{ steps.versionReader.outputs.buildMetaDataType }}
    # ${{ steps.versionReader.outputs.buildMetaDataBuildNumber }}    
    

Versions in detail

# Given versionCode 345
345
{versionCode}

# Given versionName 1.2.3-beta.543+debug.253
1.2.3-beta.543+debug.253
{1.2.3-beta.543+debug.253}
{versionName}

1.2.3-beta.543+debug.253
{1}.{2}.{3}-{beta.543}+{debug.253}
{majorVersion}.{minorVersion}.{patchVersion}-{prereleaseVersion}+{buildMetaDataVersion}


1.2.3-beta.543+debug.253
{1}.{2}.{3}-{beta}.{543}+{debug}.{253}
{majorVersion}.{minorVersion}.{patchVersion}-{prereleaseStage}.{prereleaseBuildNumber}+{buildMetaDataType}.{buildMetaDataBuildNumber}

Some example of the version format supported

# build.gradle:
versionName "1.2.3"
versionCode 1435

# outputs:
versionName: "1.2.3"
versionCode: 1435
majorVersion: 1
minorVersion: 2
patchVersion: 3
# build.gradle:
versionName "2.0.1-alpha.1227"
versionCode 4213

# outputs:
versionName: "2.0.1-alpha.1227"
versionCode: 4213
majorVersion: 2
minorVersion: 0
patchVersion: 1

prereleaseVersion: alpha.1227
prereleaseStage: alpha
prereleaseBuildNumber: 1227
# build.gradle:
versionName "1.1.2-prerelease+meta"
versionCode 1435

# outputs:
versionName: "1.1.2-prerelease+meta"
versionCode: 1435
majorVersion: 1
minorVersion: 1
patchVersion: 2

prereleaseVersion: prerelease
prereleaseStage: prerelease
buildMetaDataVersion: meta
# build.gradle:
versionName "1.0.0-alpha.debug.1"
versionCode 4213

# outputs:
versionName: "1.0.0-alpha.debug.1"
versionCode: 4213
majorVersion: 1
minorVersion: 0
patchVersion: 0

prereleaseVersion: alpha.debug.1
prereleaseStage: alpha.debug
prereleaseBuildNumber: 1
# build.gradle:
versionName "2.0.0-rc.21+debug.123"
versionCode 4213

# outputs:
versionName: "2.0.0-rc.21+debug.123"
versionCode: 4213
majorVersion: 2
minorVersion: 0
patchVersion: 0

prereleaseVersion: rc.21
prereleaseStage: rc
prereleaseBuildNumber: 21
buildMetaDataVersion: debug.123
buildMetaDataType: debug
buildMetaDataBuildNumber: 123