2024-01-06 19:49:11 +00:00
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
|
|
|
|
stages {
|
2024-01-31 01:49:27 +00:00
|
|
|
stage('Setup') {
|
|
|
|
if (env.BRANCH_NAME == 'main') {
|
|
|
|
environment {
|
|
|
|
OUTPUT_DIR = 'plate-tool'
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
environment {
|
|
|
|
OUTPUT_DIR = 'plate-tool-beta'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-01-06 19:49:11 +00:00
|
|
|
stage('Build') {
|
|
|
|
steps {
|
|
|
|
sh '''
|
|
|
|
. "$HOME/.cargo/env"
|
2024-01-31 01:49:27 +00:00
|
|
|
trunk build --release --public-url "cool-stuff/$OUTPUT_DIR/"
|
2024-01-06 19:49:11 +00:00
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Archive') {
|
|
|
|
steps {
|
|
|
|
zip zipFile: "dist.zip", archive: true, dir: "dist/"
|
|
|
|
archiveArtifacts artifacts: "dist.zip", fingerprint: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Transfer') {
|
|
|
|
steps {
|
|
|
|
sh 'echo "put -r dist/" | sftp oracle'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
cleanWs(notFailBuild: true,
|
|
|
|
deleteDirs: true,
|
|
|
|
cleanWhenNotBuilt: false,
|
|
|
|
patterns: [[pattern: 'target/', type: 'EXCLUDE']])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|