Added Jenkinsfile
This commit is contained in:
parent
d66f2c588e
commit
44d7c56212
52
Jenkinsfile
vendored
Normal file
52
Jenkinsfile
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
NODE_ENV = 'production'
|
||||||
|
CLOUDFLARE_ACCOUNT_ID = credentials('cloudflare-account-id')
|
||||||
|
CLOUDFLARE_API_TOKEN = credentials('cloudflare-api-token')
|
||||||
|
PROJECT_NAME = 'tombutcher-ui'
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Install dependencies') {
|
||||||
|
steps {
|
||||||
|
sh 'npm install'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
sh 'npm run build'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy to Cloudflare Pages') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
npm install -g wrangler
|
||||||
|
wrangler pages deploy ./build \
|
||||||
|
--project-name $PROJECT_NAME \
|
||||||
|
--branch main \
|
||||||
|
--account-id $CLOUDFLARE_ACCOUNT_ID \
|
||||||
|
--api-token $CLOUDFLARE_API_TOKEN
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
failure {
|
||||||
|
echo 'Build or deployment failed.'
|
||||||
|
}
|
||||||
|
success {
|
||||||
|
echo 'Successfully deployed to Cloudflare Pages.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user