GithubHelp home page GithubHelp logo

gradlepluginpushversiontag's Introduction

[TOC]

description:

modify version name & code, then set git tag and push commit & tag automaticlly.

Steps

Step1: Add the JitPack repository and depndency's classpath to your build file

Add it in your root build.gradle:


buildscript {
   repositories {
        jcenter()

        // ↓↓↓↓↓↓First: Add the JitPack repository:↓↓↓↓↓↓
        maven {
            url 'https://jitpack.io'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        
        // ↓↓↓↓↓↓Second: Add classpath↓↓↓↓↓↓
        classpath 'com.github.sodino:gradlePluginPushVersionTag:1.0.8'
    }
}
	

Step2: apply pushVersionTag plugin

Add it in your build.gradle of library module or app module:

apply plugin: 'pushVersionTag'

Step3: Fill in the configuration

Add it in your build.gradle of library module or app module:

pushVersionTag {
    versionName     = '1.0.2' 
    versionCode     = 3

    tagName         = "$versionName"
    
    file            = 'app/src/main/java/com/sodino/demo/Constant.kt'  // relative to project rootDir
    regVersionName  = "const val name = \"[0-9.]+.*\""
    regVersionCode  = "const val code = \\d+"

    // alternative
    // strictMode('ignore file, path relative to rootProjectDir')
    // strictMode(['ignore file1', 'ignore file2'])
    strictMode(['app/build.gradle'])

    // alternative : 'codeComment + timestamp' as subfix string added after versionName/versionCode
    // codeComment  = "//"  // default:java
}

versionName: versionName versionCode: versionCode

tagName: the git tag name

file:: The code file which declared versionName and versionCode regVersionName: The Regex to find versionName regVersionCode: The Regex to find versionCode strictMode: If some files have been changed and are not 'ignore file', stop 'pushVersionTag' then give a hint.

Step4: execute plugin task

execute plugin task, the code changes will been commit & tag & push.

./gradlew :[library or app module name]:pushVersionTag

// for example 
./gradlew :app:pushVersionTag

effect.preview


About Sodino

gradlepluginpushversiontag's People

Contributors

sodino avatar

Stargazers

Crisy avatar TonyTang avatar Wei dongjian avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.