version: '1.0' name: pipeline-docs-build displayName: 官网静态资源构建 triggers: trigger: auto push: branches: precise: - master paths: include: - neutrino-proxy-vuepress.* variables: global: - git_token - username commit_name: aoshiguchen commit_email: aoshiguchen@dromara.org repo_url: https://gitee.com/dromara/neutrino-proxy.git target_branch: site stages: - name: stage-build displayName: 构建 strategy: naturally trigger: auto executor: - asgc steps: - step: build@nodejs name: build_nodejs displayName: Nodejs 构建 nodeVersion: 14.16.0 commands: - '# 切换到工作目录' - '' - cd ./neutrino-proxy-vuepress - '# 设置NPM源,提升安装速度' - npm config set registry https://registry.npmmirror.com - '' - '# 执行编译命令' - npm install && npm run build - '' - '# 初始化git仓库' - cd docs/.vuepress/dist - git init - '' - '# 设置Git信息' - GIT_REPO_URL=$repo_url - GIT_USERNAME=$username - GIT_NAME=$commit_name - GIT_EMAIL=$commit_email - GIT_TOKEN=$git_token - echo "https://${GIT_USERNAME}:${GIT_TOKEN}@${GIT_REPO_URL#https://}" > ~/.git-credentials - git config --global credential.helper store - git remote add origin ${GIT_REPO_URL} - git config user.name ${GIT_NAME} - git config user.email ${GIT_EMAIL} - '' - '# 将构建产物推送到目标分支' - git add -A - '# git commit -m $GITEE_COMMIT_MESSAGE' - git commit -m "update" - git checkout -b $target_branch - git push -f origin $target_branch artifacts: - name: BUILD_ARTIFACT path: - ./neutrino-proxy-vuepress/docs/.vuepress/dist caches: - ~/.npm - ~/.yarn notify: [] strategy: retry: '0'