-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
69 lines (63 loc) · 1.96 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
62
63
64
65
66
67
68
69
pipeline {
agent any
environment {
Cred_User = credentials("Cred_User")
Cred_Token = credentials("Cred_Token")
header = credentials("Header_env")
AccessToken = credentials("AccessToken")
CLOUD_STORAGE_PATH = credentials("CLOUD_STORAGE_PATH")
DB_URL = credentials("DB_URL")
}
triggers {
githubPush()
}
stages {
stage("fetch"){
steps{
echo "========pull github========"
sh "pwd"
sh "git pull https://${Cred_User}:${Cred_Token}@github.com/abdullahalshawafi/Archmetrics-Studio.git"
}
}
stage('Remove Previous node'){
steps{
sh 'sudo pkill -f node'
}
}
stage('build back env') {
steps {
sh """
touch server/.env
echo header=${header} > server/.env
echo AccessToken=${AccessToken} >> server/.env
echo CLOUD_STORAGE_PATH=${CLOUD_STORAGE_PATH} >> server/.env
echo DB_URI=${DB_URL} >> server/.env
echo PORT=80 >> server/.env
echo NODE_ENV="production" >> server/.env
"""
}
}
stage('build front env') {
steps {
sh """
ls
touch client/.env
echo REACT_APP_BASE_URL=http://www.archmetrics.org/api > client/.env
echo REACT_APP_HEADER=${header} >> client/.env
"""
}
}
stage('build') {
steps {
sh 'sudo npm run install-all'
}
}
stage('run') {
steps {
sh """
sudo npm start
"""
}
}
}
}