pipeline {
	agent none
	options { skipDefaultCheckout() }
	environment {
		BUILT_PACKAGE_VERSION = ''
	}
	stages {
		stage('Clone Repository and Build') {
			parallel{
				stage('Clone for Ubuntu and Build') {
					agent { label 'DosisUbuntu' }
					steps {
						deleteDir()
						checkout scm
						nvm(version: '16.15.1') {
							sh "npm install"
							sh "npm run make"
						}
					}
				}
			}
		}
		stage('Publish') {
			parallel {
				stage('Publish for Ubuntu') {
					agent { label 'DosisUbuntu' }
					steps {
						dir("/home/jenkins/workspace/dosis-kiosk/out/make/deb/x64/"){
							retry(3) {
								sh('for f in `ls dosis-kiosk_*.deb`; do curl -f -X POST -F file=@${f} http://ronquil.swamp.alex:5080/api/repos/dosis/dists/bionic/publish/; done')
							}
						}
					}
				}
			}
		}
	}
}
