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 .' } bat 'rmdir /S /Q build' bat 'flutter build windows -t lib\\updateTool.dart' bat "build\\windows\\x64\\runner\\release\\pokedex.exe" stash includes: "COMPLETED.md", name: "md" stash includes: "LATEST_VERSION", name: "ver" } } post { success { archiveArtifacts artifacts: "windows.tgz" cleanWs() } } } stage ("Update COMPLETED.md") { agent { label "linux" } steps { script { sh 'git checkout main' unstash "md" unstash "ver" sh ''' #!/bin/bash git add COMPLETED.md git add LATEST_VERSION git commit -m "[BOT] Update datagen files" || true git push || true ''' } } post { always { cleanWs() } } } } }