TheHideout-UI/Jenkinsfile
Tom Butcher 233812ad91
All checks were successful
thehideout/TheHideout-UI/pipeline/head This commit looks good
Deploy to production.
2026-01-02 23:21:12 +00:00

37 lines
1.1 KiB
Groovy

def deploy() {
node('ubuntu') {
try {
checkout scm
// Only deploy from main branch
def branch = env.BRANCH_NAME ?: sh(script: 'git rev-parse --abbrev-ref HEAD', returnStdout: true).trim()
if (branch != 'main') {
echo "Skipping deployment: not on main branch (current branch: ${branch})"
return
}
nodejs(nodeJSInstallationName: 'Node23') {
stage('Install') {
sh 'yarn install --frozen-lockfile --production=false'
}
stage('Build') {
sh 'NODE_ENV=production yarn build'
}
stage('Deploy') {
// Deploy to Cloudflare Pages using wrangler
withCredentials([string(credentialsId: 'th-cloudflare-api-token', variable: 'CLOUDFLARE_API_TOKEN')]) {
sh 'npx wrangler pages deploy ./dist --skip-caching --branch production'
}
}
}
} finally {
cleanWs()
}
}
}
deploy()