diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..6e4e91a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,48 @@ +pipeline { + agent any + + environment { + CLOUDFLARE_API_TOKEN = credentials('cloudflare-api-token') + GITEA_REPO = 'https://gitea.wufangzhen.com/wfz/home.git' + } + + stages { + stage('Checkout') { + steps { + echo 'Checkout code from Gitea...' + sh 'git clone ${GITEA_REPO} .' + sh 'git checkout ${BRANCH_NAME}' + } + } + + stage('Install') { + steps { + echo 'Installing dependencies...' + sh 'npm ci' + } + } + + stage('Build') { + steps { + echo 'Building VitePress site...' + sh 'npm run build' + } + } + + stage('Deploy') { + steps { + echo 'Deploying to Cloudflare Pages...' + sh 'npx wrangler pages deploy docs/.vitepress/dist --project-name=web-home --commit-hash=${GIT_COMMIT} --commit-message="${GIT_COMMIT_MESSAGE}" --commit-dirty=true' + } + } + } + + post { + success { + echo 'Deployment successful!' + } + failure { + echo 'Deployment failed!' + } + } +} \ No newline at end of file