53 lines
985 B
Groovy
53 lines
985 B
Groovy
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.'
|
|
}
|
|
}
|
|
}
|