#!/usr/bin/env groovy

pipeline {
    agent any
    options {
        timestamps()
        ansiColor('xterm')
    }  
    stages {
        stage('Build package') {
            steps {
                sh """#!/bin/bash
                    ./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 focal -r ip-focal-twitch *.deb'
                    } else {
                        sh 'arti -c $ARTI_CONFIG_FILE deb -o focal -p testing -r ip-focal-twitch *.deb'
                    }
                }
            }
        }
    }
}
