forked from tekdi/Shikshak-dost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
62 lines (56 loc) · 1.8 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
pipeline {
agent any
stages {
stage('Clean workspace') {
steps{
script {
sh "rm -rf *"
}
}
}
stage('Checkout'){
steps{
git branch: 'main' , url: 'https://github.com/Aar-if/Shikshak-dost.git'
}
}
stage('BuildingCode') {
steps{
dir('/var/lib/jenkins/workspace/teacherapp-shiksha'){
sh "rm -rf node_modules"
sh "rm -rf package-lock.json"
sh "ls"
//sh "yarn install"
sh "npm i --legacy-peer-deps"
sh "npm run build"
}
}
}
stage('Deployment') {
steps{
dir ('/var/lib/jenkins/workspace/teacherapp-shiksha/dist/') {
script {
def awsCliCmd = 'aws'
//sh "apt install awscli"
// Set AWS credentials
//sh "aws configure set aws_access_key_id AKIA6EXR534WHAGNPPCS"
//sh "aws configure set aws_secret_access_key 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"
//sh "aws configure set default.region ap-south-1"
def bucketName = 'onestbucket'
sh "aws s3 cp /var/lib/jenkins/workspace/teacherapp-shiksha/dist/index.html s3://${bucketName}/"
sh "aws s3 cp /var/lib/jenkins/workspace/teacherapp-shiksha/dist/vite.svg s3://${bucketName}/"
sh "aws s3 cp /var/lib/jenkins/workspace/teacherapp-shiksha/dist/assets/ s3://${bucketName}/assets/ --recursive"
}
}
}
}
// New stage for executing ccs.sh script
stage('Execute invalidation Script') {
steps {
dir('/var/lib/jenkins/workspace'){
sh 'cd /var/lib/jenkins/workspace'
sh 'sh teacherapp.sh'
}
}
}
}
}