BugVault/Jenkinsfile

192 lines
No EOL
4.5 KiB
Groovy

pipeline {
agent any
options {
buildDiscarder (
logRotator(
numToKeepStr: '5'
)
)
}
stages {
stage("Compile Windows") {
agent {
label 'windows'
}
steps {
script {
bat 'mkdir out'
bat 'flutter pub get'
bat 'flutter build windows'
dir("build\\windows\\x64\\runner\\Release") {
bat 'tar -cvf ..\\..\\..\\..\\..\\windows.tgz .'
}
}
}
post {
always {
archiveArtifacts artifacts: "windows.tgz"
cleanWs()
}
}
}
stage("Build Linux") {
agent {
label 'linux'
}
steps {
script {
sh '''
#!/bin/bash
flutter pub get
mkdir out
flutter build linux
'''
dir("build/linux/x64/release/bundle") {
sh 'tar -cvf ../../../../../linux.tgz .'
}
}
}
post {
always {
archiveArtifacts artifacts: "linux.tgz"
cleanWs()
}
}
}
stage("Build Android") {
agent {
label 'linux'
}
steps {
script {
sh '''
#!/bin/bash
flutter pub get
mkdir out
flutter build apk
flutter build appbundle
'''
dir("build/app/outputs/bundle/release") {
sh 'cp app-release.aab ../../../../../bugvault.aab'
}
dir("build/app/outputs/flutter-apk") {
sh 'cp app-release.apk ../../../../bugvault.apk'
}
}
}
post {
always {
archiveArtifacts artifacts: "bugvault.aab"
archiveArtifacts artifacts: "bugvault.apk"
cleanWs()
}
}
}
stage("Build Web") {
agent {
label 'linux'
}
steps {
script {
sh '''
#!/bin/bash
flutter pub get
mkdir out
flutter build web
'''
dir("build/web") {
sh 'tar -cvf ../../web.tgz .'
}
}
}
post {
always {
archiveArtifacts artifacts: "web.tgz"
cleanWs()
}
}
}
stage("Build Server") {
agent {
label 'linux'
}
steps {
script {
sh '''
#!/bin/bash
dart pub get
mkdir out
dart compile exe -o out/server cli/server.dart
mv out/server bugvaultd
'''
}
}
post {
always {
archiveArtifacts artifacts: "bugvaultd"
cleanWs()
}
}
}
stage("Build Docker") {
agent {
label 'dockermain'
}
steps {
script {
sh '''
#!/bin/bash
docker build -t git.zontreck.com/packages/bugvault:latest "$(pwd)"
docker push git.zontreck.com/packages/bugvault:latest
docker rmi -f git.zontreck.com/packages/bugvault:latest || true
docker buildx prune -a -f || true
docker rmi git.zontreck.com/packages/flutter:latest || true
docker rmi git.zontreck.com/packages/debian:base || true
docker builder prune -a -f || true
'''
}
}
post {
always {
cleanWs()
}
}
}
}
}