fix: create wrangler.toml dynamically
This commit is contained in:
23
Jenkinsfile
vendored
23
Jenkinsfile
vendored
@@ -3,27 +3,30 @@ pipeline {
|
|||||||
|
|
||||||
environment {
|
environment {
|
||||||
CLOUDFLARE_API_TOKEN = 'cfut_cYi1Do6CdWPGD8ecrJ6ZtnOMcjU2GI6LdEToDEct71ff4034'
|
CLOUDFLARE_API_TOKEN = 'cfut_cYi1Do6CdWPGD8ecrJ6ZtnOMcjU2GI6LdEToDEct71ff4034'
|
||||||
|
CF_ACCOUNT_ID = '0a0b9995a00648aadf505e235e66458a'
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Install') {
|
|
||||||
steps {
|
|
||||||
echo 'Installing dependencies...'
|
|
||||||
sh 'npm ci && npm install wrangler@3.114.0'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
echo 'Building VitePress site...'
|
echo 'Building VitePress site...'
|
||||||
sh 'npm run build'
|
sh 'npm ci && npm run build'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
steps {
|
steps {
|
||||||
echo 'Deploying to Cloudflare Pages...'
|
echo 'Deploying to Cloudflare Pages via wrangler...'
|
||||||
sh 'rm -f wrangler.toml && ./node_modules/.bin/wrangler pages deploy docs/.vitepress/dist --project-name=web-home'
|
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
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user