Use Cloudflare API directly for deployment

This commit is contained in:
wfz
2026-05-06 18:02:32 +08:00
parent a776bd1ce8
commit 482fe422a3

2
Jenkinsfile vendored
View File

@@ -23,7 +23,7 @@ pipeline {
stage('Deploy') {
steps {
echo 'Deploying to Cloudflare Pages...'
sh 'npx wrangler@3 pages deploy docs/.vitepress/dist --project-name=web-home --commit-hash=${GIT_COMMIT} --commit-message="${GIT_COMMIT_MESSAGE}" --commit-dirty=true'
sh '''cd docs/.vitepress/dist && tar -czf /tmp/dist.tar.gz * && cd /tmp && curl -s -X POST "https://api.cloudflare.com/client/v4/accounts/0a0b9995a00648aadf505e235e66458a/pages/projects/web-home/deployments" -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" -F "file=@dist.tar.gz" -F "manifest={\\"version\\":1,\\"files\\":{\\"\\":\\"build\\"}}" -F "metadata={\\"branch\\":\\"main\\",\\"commit_hash\\":\\"$GIT_COMMIT\\",\\"skip_caching\\":true}"'''
}
}
}