wangzilun
2022-01-18 d10f033d23712bad0f5ef76774642f1d34b19e82
新增版本号脚本测试
3 files modified
1 files added
34 ■■■■ changed files
Jenkinsfile 10 ●●●●● patch | view | raw | blame | history
pom.xml 3 ●●●●● patch | view | raw | blame | history
src/main/java/git_study.java 18 ●●●●● patch | view | raw | blame | history
test.js 3 ●●●● patch | view | raw | blame | history
Jenkinsfile
@@ -80,6 +80,10 @@
        }
        stage('version add') {
            when {
                //版本号自动添加逻辑需同时符合下列触发条件:
                //1. 不能在master分支触发
                //2. 有任意浏览器页面资源文件修改
                //3. 不包含[项目名.java]文件的修改
                allOf {
                    not {
                        branch 'master'
@@ -97,11 +101,9 @@
                    }
                }
            }
            steps{
                echo "todo add version"
            steps {
                versionAddTest("${project_name}","${GIT_CREDENTIALS_ID}","${url}","${GIT_BRANCH}")
            }
        }
        stage('deploy') {
            when { branch 'master' }
pom.xml
@@ -24,6 +24,9 @@
    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <!--当前项目版本号-->
        <revision>1.8.0-SNAPSHOT</revision>
        <maven.deploy.skip>true</maven.deploy.skip>
    </properties>
    <build>
        <plugins>
src/main/java/git_study.java
New file
@@ -0,0 +1,18 @@
/**
 * 测试项目<br>
 */
public class git_study {
    /**
     * 保证每次打包发现场部署时增长(目前仅增长末位 +1)
     */
    String version = "1.8.0-SNAPSHOT-1";
    /**
     * 获取版本号。可用于前端资源引用版本化,解决浏览器缓存问题。
     *
     * @return 版本号
     */
    public String getVersion() {
        return version;
    }
}
test.js
@@ -30,4 +30,5 @@
    detached1
    detached2
    detached3
    detached4
    detached4
111