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() } } } stage ("Build Windows") { agent { label 'windows' } steps { script { bat 'flutter pub get' bat 'flutter build windows' dir ("build/windows/x64/runner/release") { bat 'tar -cvf ../../../../../windows.tgz .' } } } post { success { archiveArtifacts artifacts: "windows.tgz" cleanWs() } } } } }