diff --git a/Jenkinsfile b/Jenkinsfile index 209c5e6..26903c8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -64,7 +64,10 @@ pipeline { } } } - stage('Build snap package') { + stage('Build and upload snap package') { + environment { + SNAP_LOGIN=credentials('snapcraft_login') + } when { anyOf { branch 'dev' @@ -75,8 +78,19 @@ pipeline { echo 'Building snap package...' sh 'docker build -f ./devops/snapcraft/Dockerfile -t \ snapcraft-build .' + echo 'Building snap package...' sh 'docker run -v "${PWD}":/build -w /build \ - snapcraft-build:latest snapcraft' + snapcraft-build:latest snapcraft' + echo 'Pushing package to snap store' + sh(''' + mkdir -p .snapcraft + cat ${SNAP_LOGIN} | base64 --decode --ignore-garbage \ + > .snapcraft/snapcraft.cfg + docker run -v "${PWD}":/build -w /build \ + snapcraft-build:latest snapcraft \ + push --release edge *.snap + rm -rf .snapcraft + ''') } } }