Skip to content
activity

GitHub Action

Get gradle version action

v1.0 Latest version

Get gradle version action

activity

Get gradle version action

Extracts the version string from the build.gradle file

Installation

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

              

- name: Get gradle version action

uses: thecodemonkey/action-get-gradle-version@v1.0

Learn more about this action in thecodemonkey/action-get-gradle-version

Choose a version

Get gradle version action

(a fork of get npm version action: https://github.com/pchynoweth/action-get-npm-version)



extracts the version string from the build.gradle file



Example usage

name: GET GRADLE VERSION

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.version.outputs.version }}              # <- put the version to output of the current job 
    steps:                                                       #    to share the version between different jobs
      - uses: actions/checkout@v2
      
      
      
      - uses: thecodemonkey/action-get-gradle-version@master     # <- USE THIS ACTION TO READ THE VERSION FROM BUILD.GRADLE
        id: version                                              # <- give this step an id to access the output of the step
        
        
        
        
      - run: 'echo version ${{ steps.version.outputs.version }}' # <- access the version
 
  deploy:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - run: 'echo version ${{needs.build.outputs.version}}'     # <- access the version in another job
      



Inputs

file

Optional The build.gradle file. Default "build.gradle".

use this input parameter if the build.gradle file is in a different directory.

  - uses: thecodemonkey/action-get-gradle-version@master
    with:
      file: module/subfolder/build.gradle



Outputs

version

the version inside build.gradle file. You have to give the step an id to access the output.

  - uses: thecodemonkey/action-get-gradle-version@master
    id: getversion
  - run: 'echo version ${{ steps.getversion.outputs.version }}' 



License

The scripts and documentation in this project are released under the MIT License