withNPM
This commit is contained in:
		
							parent
							
								
									c798773d79
								
							
						
					
					
						commit
						50c6d9337c
					
				
							
								
								
									
										1
									
								
								publish/Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								publish/Jenkinsfile
									
									
									
									
										vendored
									
									
								
							@ -4,6 +4,7 @@ stage ('publish') {
 | 
			
		||||
        def tag = sh(returnStdout: true, script: "git tag --contains").trim()
 | 
			
		||||
        if (tag) {
 | 
			
		||||
            echo 'found tag ' + tag
 | 
			
		||||
            sh "echo '${JEN_FILES_TMP_NAME}' >> .npmignore"
 | 
			
		||||
            sh 'npm publish --access public'
 | 
			
		||||
        } else {
 | 
			
		||||
            echo 'tag not found'
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								publish/new/Jenkinsfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								publish/new/Jenkinsfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
			
		||||
stage ('publish') {
 | 
			
		||||
    echo 'checking tag'
 | 
			
		||||
    script {
 | 
			
		||||
        def tag = sh(returnStdout: true, script: "git tag --contains").trim()
 | 
			
		||||
        if (tag) {
 | 
			
		||||
            echo 'found tag ' + tag
 | 
			
		||||
            sh "echo '${JEN_FILES_TMP_NAME}' >> .npmignore"
 | 
			
		||||
            withNPM(npmrcConfig:'npm-cfg') {
 | 
			
		||||
                echo "Performing npm build..."
 | 
			
		||||
                sh 'npm publish --access public'
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            echo 'tag not found'
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										36
									
								
								templates/publish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								templates/publish
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,36 @@
 | 
			
		||||
def clean () {
 | 
			
		||||
    sh 'rm -rf .[!.]*'
 | 
			
		||||
    sh 'rm -rf ./*'
 | 
			
		||||
    sh 'ls -a'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
def clone (String repoPath, String folder) {
 | 
			
		||||
   echo 'cloning...'
 | 
			
		||||
   sh "git clone ${repoPath}.git tmp"
 | 
			
		||||
   sh "mkdir -p ${folder}"
 | 
			
		||||
   sh "mv ./tmp/* ./${folder}"
 | 
			
		||||
   sh "mv ./tmp/.[!.]* ./${folder}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
def loadScript (String scriptName) {
 | 
			
		||||
    load "${JEN_FILES_TMP_NAME}/${scriptName}/Jenkinsfile"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pipeline {
 | 
			
		||||
   agent any
 | 
			
		||||
 | 
			
		||||
   stages {
 | 
			
		||||
      stage('processing') {
 | 
			
		||||
         steps {
 | 
			
		||||
                clean()
 | 
			
		||||
                clone(JENKINS_SCRIPTS_URL, JEN_FILES_TMP_NAME)
 | 
			
		||||
                loadScript('stats')
 | 
			
		||||
                clone('https://aaprimakov@bitbucket.org/jsadvance20201/ijl-cli', './')
 | 
			
		||||
                sh "echo '${JEN_FILES_TMP_NAME}/' >> .npmignore"
 | 
			
		||||
                loadScript('publish')
 | 
			
		||||
                loadScript('clean-all')
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user