From 14f2181e9148af151d1055c3624298e6f3b3a66a Mon Sep 17 00:00:00 2001 From: wfz Date: Thu, 7 May 2026 11:38:53 +0800 Subject: [PATCH] fix: create wrangler.toml dynamically --- Jenkinsfile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 575c982..f160c8b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 + ''' } } }