2024-01-06 19:49:11 +00:00
|
|
|
pipeline {
|
|
|
|
agent any
|
2024-01-31 01:56:48 +00:00
|
|
|
environment {
|
|
|
|
OUTPUT_DIR = "${env.BRANCH_NAME == "main" ? "plate-tool" : "plate-tool-beta"}"
|
|
|
|
}
|
2024-01-06 19:49:11 +00:00
|
|
|
|
|
|
|
stages {
|
2024-02-14 01:38:45 +00:00
|
|
|
stage('Parent') {
|
|
|
|
when { anyOf { branch 'main'; branch 'beta-release' } }
|
|
|
|
stages {
|
2024-01-06 19:49:11 +00:00
|
|
|
stage('Build') {
|
|
|
|
steps {
|
|
|
|
sh '''
|
|
|
|
. "$HOME/.cargo/env"
|
2024-02-14 01:46:17 +00:00
|
|
|
cd plate-tool-web
|
2024-11-13 23:18:21 +00:00
|
|
|
trunk build --release --public-url "./"
|
2024-01-06 19:49:11 +00:00
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Archive') {
|
|
|
|
steps {
|
2024-02-14 01:48:54 +00:00
|
|
|
zip zipFile: "dist.zip", archive: true, dir: "plate-tool-web/dist/"
|
2024-01-06 19:49:11 +00:00
|
|
|
archiveArtifacts artifacts: "dist.zip", fingerprint: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Transfer') {
|
|
|
|
steps {
|
2024-02-14 01:48:54 +00:00
|
|
|
sh 'echo "put -r plate-tool-web/dist/" | sftp oracle'
|
2024-01-06 19:49:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Deploy') {
|
|
|
|
steps {
|
|
|
|
sh '''
|
2024-01-31 01:49:27 +00:00
|
|
|
ssh oracle "sudo rm -rf /usr/share/nginx/html/$OUTPUT_DIR/ && sudo mv dist /usr/share/nginx/html/$OUTPUT_DIR"
|
2024-01-06 19:49:11 +00:00
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-02-14 01:38:45 +00:00
|
|
|
}
|
|
|
|
}
|
2024-01-06 19:49:11 +00:00
|
|
|
post {
|
|
|
|
always {
|
|
|
|
cleanWs(notFailBuild: true,
|
|
|
|
deleteDirs: true,
|
|
|
|
cleanWhenNotBuilt: false,
|
|
|
|
patterns: [[pattern: 'target/', type: 'EXCLUDE']])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|