| clone_depth: 5 |
| |
| environment: |
| access_token: |
| secure: You Access Token |
| matrix: |
| - nodejs_version: "12" //因为node 14版本生成页面和文件为空,这里改为12版本 |
| install: |
| - ps: Install-Product node $env:nodejs_version |
| - node --version |
| - npm --version |
| - npm install |
| - npm install hexo-cli -g |
| |
| build_script: |
| - hexo generate |
| |
| artifacts: |
| - path: public |
| |
| on_success: |
| - git config --global credential.helper store |
| - ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n" |
| - git config --global user.email "%GIT_USER_EMAIL%" |
| - git config --global user.name "%GIT_USER_NAME%" |
| - git clone --depth 5 -q --branch=%TARGET_BRANCH% %STATIC_SITE_REPO% %TEMP%\static-site |
| - cd %TEMP%\static-site |
| - del * /f /q |
| - for /d %%p IN (*) do rmdir "%%p" /s /q |
| - SETLOCAL EnableDelayedExpansion & robocopy "%APPVEYOR_BUILD_FOLDER%\public" "%TEMP%\static-site" /e & IF !ERRORLEVEL! EQU 1 (exit 0) ELSE (IF !ERRORLEVEL! EQU 3 (exit 0) ELSE (exit 1)) |
| - git add -A |
| - git commit -m "Update Static Site" |
| - git push origin %TARGET_BRANCH% |
| - appveyor AddMessage "Static Site Updated" |