Merge pull request 'Update main version' (#7) from beta-release into main
Gitea Scan/plate-tool/pipeline/head This commit looks good Details

Reviewed-on: #7
This commit is contained in:
Emilia Allison 2024-01-31 02:00:40 +00:00
commit ca5c15756e
1 changed files with 43 additions and 0 deletions

43
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,43 @@
pipeline {
agent any
environment {
OUTPUT_DIR = "${env.BRANCH_NAME == "main" ? "plate-tool" : "plate-tool-beta"}"
}
stages {
stage('Build') {
steps {
sh '''
. "$HOME/.cargo/env"
trunk build --release --public-url "cool-stuff/$OUTPUT_DIR/"
'''
}
}
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 '''
ssh oracle "sudo rm -rf /usr/share/nginx/html/$OUTPUT_DIR/ && sudo mv dist /usr/share/nginx/html/$OUTPUT_DIR"
'''
}
}
}
post {
always {
cleanWs(notFailBuild: true,
deleteDirs: true,
cleanWhenNotBuilt: false,
patterns: [[pattern: 'target/', type: 'EXCLUDE']])
}
}
}