Skip to content

Instantly share code, notes, and snippets.

@moatazeldebsy
Last active August 9, 2021 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moatazeldebsy/9ca9dba0718f9ddabdd6ca9c19b8e004 to your computer and use it in GitHub Desktop.
Save moatazeldebsy/9ca9dba0718f9ddabdd6ca9c19b8e004 to your computer and use it in GitHub Desktop.
def appname = "Runner" // This refers to the flutter 'Runner' target.
def xcarchive = "${appname}.xcarchive"
pipeline {
agent { label 'Flutter' } //Change this to whatever your flutter jenkins nodes are labeled.
environment {
DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer/" //This is necessary for Fastlane to access iOS Build things.
APPCENTER_API_TOKEN = credentials('at-this-moment-you-should-be-with-us')
}
stages {
stage ('Checkout') {
steps {
checkout scm
}
}
stage ('Flutter Doctor') {
steps {
sh "flutter doctor -v"
}
}
stage ('Run Flutter Tests') {
steps {
sh "flutter test --coverage test/my_tests.dart"
}
}
stage ('Flutter Build APK') {
steps {
sh "flutter build apk --split-per-abi"
}
}
stage('Distribute Android APK') {
steps {
appCenter apiToken: 'API_TOKEN_HERE',
ownerName: 'OWNER_NAME',
appName: 'APP_NAME',
pathToApp: 'build/app/outputs/apk/release/app-release.apk',
distributionGroups: 'DISTRIBUTION_GROUP'
}
}
stage('Flutter Build iOS') {
steps {
sh "flutter build ios --release --no-codesign"
}
}
stage('Make iOS IPA And Distribute') {
steps {
dir('ios'){
sh "bundle install"
sh "bundle exec fastlane release --verbose"
}
}
}
stage('Cleanup') {
steps {
sh "flutter clean"
}
}
}
post {
success {
slackSend channel: '#automation', message: 'The $BUILD_NUMBER succeeded and the apps uploaded successfully'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment