-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathJenkinsfile
61 lines (52 loc) · 1.86 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
pipeline {
agent any // Use any available agent
environment {
GCS_BUCKET = 'indexpck' // Replace with your GCS bucket name
}
stages {
stage('Checkout') {
steps {
// Checkout code from Git repository
git branch: 'development', url: 'https://github.com/Play2HelpWorld-com/Play2World3D_Desktop.git' // Replace with your git repo URL
}
}
stage('Get Git Build Number') {
steps {
script {
// Get the latest commit hash and set it as a variable
env.GIT_BUILD_NUMBER = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
}
}
}
stage('Import Resources') {
steps {
script {
// Import resources to ensure they're properly handled
sh "godot --headless --path . --import"
}
}
}
stage('Export to ZIP') {
steps {
script {
// Define the output ZIP file name using the build number
def zipFileName = "play2world3d_desktop_${env.GIT_BUILD_NUMBER}.zip"
// Ensure the zip_folder exists before exporting
sh 'mkdir -p zip_folder'
// Run Godot export command to create a ZIP file
sh "godot --headless --export-pack 'win' zip_folder/${zipFileName}"
// Upload the ZIP file to GCS
sh "gsutil cp zip_folder/${zipFileName} gs://$GCS_BUCKET/"
}
}
}
}
post {
success {
echo 'Export to ZIP and upload to GCS completed successfully!'
}
failure {
echo 'There was an error in the pipeline.'
}
}
}