Merge pull request 'Update main version' (#7) from beta-release into main
	
		
			
	
		
	
	
		
			
				
	
				Gitea Scan/plate-tool/pipeline/head This commit looks good
				
					Details
				
			
		
	
				
					
				
			
				
	
				Gitea Scan/plate-tool/pipeline/head This commit looks good
				
					Details
				
			
		
	Reviewed-on: #7
This commit is contained in:
		
						commit
						ca5c15756e
					
				| 
						 | 
				
			
			@ -0,0 +1,43 @@
 | 
			
		|||
pipeline {
 | 
			
		||||
    agent any
 | 
			
		||||
    environment {
 | 
			
		||||
    	OUTPUT_DIR = "${env.BRANCH_NAME == "main" ? "plate-tool" : "plate-tool-beta"}"
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    stages {
 | 
			
		||||
        stage('Build') {
 | 
			
		||||
            steps {
 | 
			
		||||
                sh '''
 | 
			
		||||
                    . "$HOME/.cargo/env"
 | 
			
		||||
                    trunk build --release --public-url "cool-stuff/$OUTPUT_DIR/"
 | 
			
		||||
                '''
 | 
			
		||||
            }
 | 
			
		||||
	    }
 | 
			
		||||
	stage('Archive') {
 | 
			
		||||
		steps {
 | 
			
		||||
			zip zipFile: "dist.zip", archive: true, dir: "dist/"
 | 
			
		||||
			archiveArtifacts artifacts: "dist.zip", fingerprint: true
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	stage('Transfer') {
 | 
			
		||||
		steps {
 | 
			
		||||
			sh 'echo "put -r dist/" | sftp oracle'
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	stage('Deploy') {
 | 
			
		||||
		steps {
 | 
			
		||||
			sh '''
 | 
			
		||||
			ssh oracle "sudo rm -rf /usr/share/nginx/html/$OUTPUT_DIR/ && sudo mv dist /usr/share/nginx/html/$OUTPUT_DIR"
 | 
			
		||||
			'''
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
    post {
 | 
			
		||||
	always {
 | 
			
		||||
		cleanWs(notFailBuild: true,
 | 
			
		||||
			deleteDirs: true,
 | 
			
		||||
			cleanWhenNotBuilt: false,
 | 
			
		||||
			patterns: [[pattern: 'target/', type: 'EXCLUDE']])
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue