UNPKG

use-on-demand

Version:
154 lines (128 loc) 5.48 kB
# TIP 第一种【AMD】的处理器 arch : amd64 # optional, this is default, routes to a full VM os : linux # optional, this is default dist : focal # or bionic | xenial | trusty | precise with xenial as default # TIP 第二种【ARM】的处理器 ## 处理器架构,影响【VM】和【LXD】的选用 #arch: arm64-graviton2 # in AWS over Graviton2 CPU ## 虚拟机的架构类型 #virt: vm # required, routes to a 'full VM' instance ## 操作系统 #os: linux # required for arch different than amd64 ## 发行版本 #dist: focal # or bionic | xenial | trusty | precise with xenial as default #group: edge # # ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— # 设置语言 language : node_js # 设置语言版本 node_js : "12.16.1" # 这种方式,更为专业,会从【$HOME/.npm or node_modules】中自动选择。(【npm install】和【npm ci】,存在区别) cache : npm # 这种方式,较为死板 #cache: # directories: # - node_modules #缓存依赖 before_cache : - echo 'before_cache' # 构建生命周期 # S: Build Lifecycle # 【install】阶段之前执行 before_install : - echo 'before_install' # 后续很多命令,都要用到【nps】这个工具 # WARN 此处,关于【清除缓存】的处理 - pwd - ls node_modules # WARN 如果没有【npm install "github:hanshou101/use-on-demand#master" --force】的话,则【Travis】必须要清除缓存,才能正常运行这个项目。(就很奇怪??????) #- echo '清除缓存开始' && npm cache clean --force && rm -rf node_modules package-lock.json && echo '清除缓存完毕' - npm i nps -g - npm i codecov -g install : # WARN 在【npm install】之前使用这句话,避免了【找不到 use-on-demand/node_modules/use-on-demand】的错误。 - npm install "github:hanshou101/use-on-demand#master" --force - npm i # 【script】阶段之前执行 before_script : - echo 'before-script' script : # 开始进行测试报告 - npm run test____jest # 分成两句写,这样前面的【测试】失败后,后面的【codecov】仍然能执行。 - codecov # 生成静态文件 - npm run vuepress____docs:build - npm run vuepress____gen-sitemap # 生成【typedoc】TypeScript文档 - npm run ts____build-typedoc # 【script】阶段失败时执行 after_failure : - echo 'after_failure' # 【script】阶段成功时执行 after_success : - echo 'after_success' # 【deploy】步骤之前执行 before_deploy : - echo 'before_deploy' # 以下,是【GitHub Pages】的另外一种配置方法 deploy : # provider: pages # skip_cleanup: true # github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard # on: # branch: master # # # # # WARN 【deploy】的配置方法和常规的不同!!!不能用常规的思路去配置 # 命令里面的变量都是在Travis CI里配置过的。 # - echo '这里,经过了重新改造' # - cd "../../lib-docs-dist" # - git config user.name "${GitHub_UserName}" # - git config user.email "${GitHub_UserEmail}" # - git init # - git add . # - git commit -m ":construction_worker:- Build & Deploy by Travis CI" # # - git push --force --quiet "https://${GitHub_Token}@${GH_REF}" gh-pages:${D_BRANCH} # - git push -f "${GitHub_Pages_Repo_Url}" ${GitHub_Pages_Repo_Branch} # - cd - # 【deploy】步骤之后执行 after_deploy : - echo 'after_deploy' # 【script】阶段之后执行 after_script : - echo 'after_script' # after_script前5句是把部署分支的.git文件夹保护起来,用于保留历史部署的commit日志,否则部署分支永远只有一条commit记录。 # - echo "开始备份【历史部署的commit日志】" # - git clone https://${GH_REF} .temp # - cd .temp # - git checkout gh-pages # - cd ../ # - mv .temp/.git dist # - cd dist # 命令里面的变量都是在Travis CI里配置过的。 # - git config user.name "${U_NAME}" # - git config user.email "${U_EMAIL}" # - git add . # - git commit -m ":construction_worker:- Build & Deploy by Travis CI" # - git push --force --quiet "https://${Travis_Token}@${GH_REF}" gh-pages:${D_BRANCH} # # 命令里面的变量都是在Travis CI里配置过的。 - echo '这里,经过了重新改造' - cd "./lib-docs-dist" - git init - git add . - git config user.name "${GitHub_UserName}" - git config user.email "${GitHub_UserEmail}" - git commit -m ":construction_worker:- Build & Deploy by Travis CI" # - git push --force --quiet "https://${GitHub_Token}@${GH_REF}" gh-pages:${D_BRANCH} # WARN 务必要开启【quiet】选项,不然你的【API TOKEN】可能会泄露! - git push -f -q "https://hanshou101:${GitHub_Token}@github.com/hanshou101/hanshou101.github.io.git" ${GitHub_Pages_Repo_Branch} - cd - # End结束: Build LifeCycle # 只有指定的分支提交时才会运行脚本 branches : only : - master