fix: create wrangler.toml dynamically

This commit is contained in:
wfz
2026-05-07 11:38:53 +08:00
parent 01d77185c9
commit 14f2181e91

23
Jenkinsfile vendored
View File

@@ -3,27 +3,30 @@ pipeline {
environment {
CLOUDFLARE_API_TOKEN = 'cfut_cYi1Do6CdWPGD8ecrJ6ZtnOMcjU2GI6LdEToDEct71ff4034'
CF_ACCOUNT_ID = '0a0b9995a00648aadf505e235e66458a'
}
stages {
stage('Install') {
steps {
echo 'Installing dependencies...'
sh 'npm ci && npm install wrangler@3.114.0'
}
}
stage('Build') {
steps {
echo 'Building VitePress site...'
sh 'npm run build'
sh 'npm ci && npm run build'
}
}
stage('Deploy') {
steps {
echo 'Deploying to Cloudflare Pages...'
sh 'rm -f wrangler.toml && ./node_modules/.bin/wrangler pages deploy docs/.vitepress/dist --project-name=web-home'
echo 'Deploying to Cloudflare Pages via wrangler...'
sh '''
rm -f wrangler.toml
cat > wrangler.toml << EOF
name = "web-home"
account_id = "$CF_ACCOUNT_ID"
pages_project = "web-home"
compatibility_date = "2024-01-01"
EOF
wrangler pages deploy docs/.vitepress/dist
'''
}
}
}