-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
67 lines (54 loc) · 1.64 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
pipeline {
agent any
environment {
PATH = "/Users/barry/Documents/flutter/bin:$PATH"
}
stages {
stage('Checkout') {
steps {
// Checkout your source code repository
checkout scm
}
}
stage('Copy Files') {
steps {
// Assuming you have files to copy in the same directory as your Jenkinsfile
script {
sh 'cp -r /Users/barry/Desktop/jenkins-copy-files/* ./android/'
}
}
}
stage('Build APK') {
steps {
// Run 'flutter build apk' command
script {
sh 'flutter clean'
sh 'flutter pub get'
sh 'flutter build apk'
}
}
}
stage('Slack Notification') {
when {
expression { currentBuild.resultIsBetterOrEqualTo('SUCCESS') }
}
steps {
script {
slackSend channel: "#jenkins-apk", message: "Build Started: ${env.JOB_NAME} ${env.BUILD_NUMBER}", teamDomain: "aukfa", tokenCredentialId: "slack-token"
slackUploadFile channel: "#jenkins-apk", credentialId: "slack-file-token", filePath: "build/app/outputs/flutter-apk/app-release.apk", initialComment: "this is test"
}
}
}
}
post {
always {
echo 'Its working...'
}
success {
echo 'This will success run'
}
failure {
echo 'This will failure run'
}
}
}