Updated Jenkinsfile
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Gitea Organization/fileserver/pipeline/head There was a failure building this commit
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Gitea Organization/fileserver/pipeline/head There was a failure building this commit
				
			This commit is contained in:
		
							
								
								
									
										57
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										57
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							@@ -41,7 +41,10 @@ pipeline {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        stage('Package') {
 | 
			
		||||
            agent { docker { image 'alpine:latest' reuseNode true }}
 | 
			
		||||
            agent { docker {
 | 
			
		||||
                image 'alpine:latest'
 | 
			
		||||
                reuseNode true
 | 
			
		||||
            }}
 | 
			
		||||
            steps {
 | 
			
		||||
                sh 'apk add tar xz'
 | 
			
		||||
                dir('static') {
 | 
			
		||||
@@ -55,36 +58,38 @@ pipeline {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        stage('Release') {
 | 
			
		||||
            agent { docker { image 'alpine:latest' reuseNode true }}
 | 
			
		||||
            agent any
 | 
			
		||||
            when { buildingTag() }
 | 
			
		||||
            environment {
 | 
			
		||||
                TOKEN = credentials('abd7020c-43d6-485b-ae09-2f9b484d9c15')
 | 
			
		||||
            }
 | 
			
		||||
            steps {
 | 
			
		||||
                def release_body = [
 | 
			
		||||
                    'name': "Version ${TAG_NAME}",
 | 
			
		||||
                    'tag_name': "${TAG_NAME}",
 | 
			
		||||
                    'is_draft': false,
 | 
			
		||||
                    'is_prerelease': false
 | 
			
		||||
                ]
 | 
			
		||||
                def release_body_str = writeJSON returnText: true, data: release_body
 | 
			
		||||
                def release_resp = httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases',
 | 
			
		||||
                    acceptType: 'APPLICATION_JSON',
 | 
			
		||||
                    contentType: 'APPLICATION_JSON',
 | 
			
		||||
                    customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]],
 | 
			
		||||
                    httpMode: 'POST',
 | 
			
		||||
                    requestBody: release_body_str
 | 
			
		||||
                def release_json = readJson text: release_resp.content
 | 
			
		||||
                httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases/${release_json.id}/assets?name=linux-x64-glibc.tar.xz',
 | 
			
		||||
                    httpMode: 'POST',
 | 
			
		||||
                    acceptType: 'APPLICATION_JSON',
 | 
			
		||||
                    customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]],
 | 
			
		||||
                    formData: [[contentType: 'application/octet-stream', name: 'attachment', fileName: 'linux-x64-glibc.tar.xz', uploadFile: 'linux-x64-glibc.tar.xz']]
 | 
			
		||||
                httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases/${release_json.id}/assets?name=linux-x64-muslc.tar.xz',
 | 
			
		||||
                    httpMode: 'POST',
 | 
			
		||||
                    acceptType: 'APPLICATION_JSON',
 | 
			
		||||
                    customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]],
 | 
			
		||||
                    formData: [[contentType: 'application/octet-stream', name: 'attachment', fileName: 'linux-x64-muslc.tar.xz', uploadFile: 'linux-x64-muslc.tar.xz']]
 | 
			
		||||
                script {
 | 
			
		||||
                    def release_body = [
 | 
			
		||||
                        'name': "Version ${TAG_NAME}",
 | 
			
		||||
                        'tag_name': "${TAG_NAME}",
 | 
			
		||||
                        'is_draft': false,
 | 
			
		||||
                        'is_prerelease': false
 | 
			
		||||
                    ]
 | 
			
		||||
                    def release_body_str = writeJSON returnText: true, data: release_body
 | 
			
		||||
                    def release_resp = httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases',
 | 
			
		||||
                        acceptType: 'APPLICATION_JSON',
 | 
			
		||||
                        contentType: 'APPLICATION_JSON',
 | 
			
		||||
                        customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]],
 | 
			
		||||
                        httpMode: 'POST',
 | 
			
		||||
                        requestBody: release_body_str
 | 
			
		||||
                    def release_json = readJson text: release_resp.content
 | 
			
		||||
                    httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases/${release_json.id}/assets?name=linux-x64-glibc.tar.xz',
 | 
			
		||||
                        httpMode: 'POST',
 | 
			
		||||
                        acceptType: 'APPLICATION_JSON',
 | 
			
		||||
                        customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]],
 | 
			
		||||
                        formData: [[contentType: 'application/octet-stream', name: 'attachment', fileName: 'linux-x64-glibc.tar.xz', uploadFile: 'linux-x64-glibc.tar.xz']]
 | 
			
		||||
                    httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases/${release_json.id}/assets?name=linux-x64-muslc.tar.xz',
 | 
			
		||||
                        httpMode: 'POST',
 | 
			
		||||
                        acceptType: 'APPLICATION_JSON',
 | 
			
		||||
                        customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]],
 | 
			
		||||
                        formData: [[contentType: 'application/octet-stream', name: 'attachment', fileName: 'linux-x64-muslc.tar.xz', uploadFile: 'linux-x64-muslc.tar.xz']]
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user