#!/usr/bin/env groovy

pipeline {
    agent any
    options {
        timestamps()
        ansiColor('xterm')
    }  
    stages {
        stage('Build package') {
            steps {
                checkout scm
	        sh """
                    ./build.sh
	        """
            }
        }
        stage('Upload package') {
            environment {
                ARTI_CONFIG_FILE = credentials('dta_arti_creds')
            }
            steps {
                script {
                    if (env.BRANCH_NAME == 'master') {
                        sh 'arti -c $ARTI_CONFIG_FILE deb -o bionic *.deb'
                    } else {
                        sh 'arti -c $ARTI_CONFIG_FILE deb -o bionic -p testing *.deb'
                    }
                }
            }
        }
    }
}
