pipeline { agent any options { buildDiscarder(logRotator(numToKeepStr: '5')) } stages { stage("Build Linux") { agent { label "linux" } steps { script { sh ''' #!/bin/bash flutter pub get flutter build linux flutter build apk flutter build appbundle ''' dir('build/linux/x64/release/bundle') { sh 'tar -czf ../../../../../linux.tgz .' } dir("build/app/outputs/flutter-apk") { sh 'mv app-release.apk ../../../../pokedex.apk' } dir("build/app/outputs/bundle/release") { sh 'mv app-release.aab ../../../../../pokedex.aab' } } } post { success { archiveArtifacts artifacts: 'linux.tgz' archiveArtifacts artifacts: 'pokedex.apk' archiveArtifacts artifacts: 'pokedex.aab' cleanWs() } } } } }