Skip to content

Commit

Permalink
feat(jenkinsfile): 🎉 add a new jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
gokhangunduz committed Nov 21, 2023
1 parent f922986 commit d294826
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
3 changes: 1 addition & 2 deletions docker/Jenkinsfile-public-demo
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ pipeline {
stage('Install Node') {
steps {
container('ubuntu') {
sh 'npm install -g n'
sh 'npm install -g n bun'
sh 'n latest'
sh 'apt-get install unzip -y'
sh 'npm install -g bun'
}
}
}
Expand Down
32 changes: 27 additions & 5 deletions docker/Jenkinsfile-public-dev
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ pipeline {
stage('Install Node') {
steps {
container('ubuntu') {
sh 'npm install -g n'
sh 'npm install -g n bun'
sh 'n latest'
sh 'apt-get install unzip -y'
}
}
}
Expand All @@ -56,25 +57,46 @@ pipeline {
}
}
}
stage('Install Deps & Build') {
stage('Install Depends') {
steps {
container('ubuntu') {
sh 'bun install'
}
}
}
stage('Build') {
steps {
container('ubuntu') {
withCredentials([file(credentialsId: 'env-frontend-public-dev', variable: 'text')]) {
writeFile file:'./.env', text: readFile(text)
}
sh 'bun react-scripts build'
}
}
}
stage('Nexus Push') {
steps {
container('ubuntu') {
withCredentials([file(credentialsId: 'env-frontend-public-dev', variable: 'text')]) {
writeFile file:'./.env', text: readFile(text)
}
sh 'npm i --force'
sh 'npm run build'
sh "tar -zcvf ui-${env.VER}-${env.BUILD_NUMBER}.tar.gz build"
withCredentials([usernamePassword(credentialsId: '7fadeb6b-976b-40ed-8c7c-20e157b4f81a', passwordVariable: 'password', usernameVariable: 'username')]) {
sh "curl --fail -u $username:$password --upload-file ui-${env.VER}-${env.BUILD_NUMBER}.tar.gz https://nexus.robolaunch.cloud/repository/ui/"
}
}
}
}
stage('Docker Build & Push') {
stage('Docker Build') {
steps {
container('docker') {
sh "docker build -t robolaunchio/frontend-public:${env.VER}-dev ."
}
}
}
stage('Docker Push') {
steps {
container('docker') {
withCredentials([usernamePassword(credentialsId: 'dockerhub-robolaunchio', passwordVariable: 'password', usernameVariable: 'username')]) {
sh 'docker login -u $username -p $password'
}
Expand Down

0 comments on commit d294826

Please sign in to comment.