Some checks failed
tombutcher.work/tombutcher-ui/pipeline/head There was a failure building this commit
58 lines
1.2 KiB
Groovy
58 lines
1.2 KiB
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'
|
|
}
|
|
|
|
tools {
|
|
nodejs 'Node23' // This should match the name of your NodeJS installation in Jenkins tools
|
|
}
|
|
|
|
stages {
|
|
stage('Checkout') {
|
|
steps {
|
|
checkout scm // Checkout the repository
|
|
}
|
|
}
|
|
|
|
stage('Install dependencies') {
|
|
steps {
|
|
sh 'ls && npm install' // Install project dependencies
|
|
stash name: 'node_modules', includes: 'node_modules/**'
|
|
}
|
|
}
|
|
|
|
stage('Build') {
|
|
steps {
|
|
unstash 'node_modules'
|
|
sh 'ls && npm ls vite && npm run build' // Build the project
|
|
}
|
|
}
|
|
|
|
stage('Deploy to Cloudflare Pages') {
|
|
steps {
|
|
sh '''
|
|
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.'
|
|
}
|
|
}
|
|
}
|