测试cnb数据漫游功能
测试cnb数据漫游功能
老版本配置
yaml
master:
push:
- runner:
cpus: 64
services:
- docker
- git-clone-yyds
imports:
- https://cnb.cool/onedayxyy/secret/-/blob/main/envs.yml
docker:
image: docker.cnb.cool/znb/images/node:18
volumes:
- /data/.cache:copy-on-write #声明式的构建缓存
新版本配置
yaml
master:
push:
# 增加 Docker 的 volumes 功能
"volume-cache":
name: 云原生构建
imports: https://cnb.cool/onedayxyy/secret/-/blob/main/envs.yml
runner:
# 自定义cpu核数 以支持构建更多文档(cpu最大64 内存会随cpuX2 128G内存)
cpus: 64
# 以下时gpu集群 这条和上面的只能选一个,gup集群cup固定32 内存最大96
# tags: cnb:arch:amd64:gpu
docker:
image: node:22
volumes:
- node_modules:copy-on-write
测试前配置
yaml
master:
push:
- runner:
cpus: 64
services:
- docker
- git-clone-yyds
imports:
- https://cnb.cool/onedayxyy/secret/-/blob/main/envs.yml
docker:
image: docker.cnb.cool/znb/images/node:18
volumes:
- /data/.cache:copy-on-write #声明式的构建缓存
stages:
- name: set env
script: echo -n $(date "+%Y-%m-%d %H:%M")
exports:
info: CUSTOM_ENV_DATE_INFO
- name: 🖨️ 打印环境
if: |
[ "$CNB_COMMIT_MESSAGE_TITLE" = "BUILD" ]
script: |
node -v && npm -v && yarn -v && pnpm -v
- name: 📦️ 安装依赖
if: |
[ "$CNB_COMMIT_MESSAGE_TITLE" = "BUILD" ]
script: |
pnpm install
- name: ⚗️ 编译项目
if: |
[ "$CNB_COMMIT_MESSAGE_TITLE" = "BUILD" ]
script: |
pnpm docs:build # VitePress 专用命令
- name: 🚚 部署到Pages
if: |
[ "$CNB_COMMIT_MESSAGE_TITLE" = "BUILD" ]
image: node:22
script: npx edgeone pages deploy ./docs/.vitepress/dist --name vitepress-theme-teek-one-private --token $EDGEONE_PAGES_API_TOKEN
# - name: 🚚 发布制品 (把Teek静态文件从云服务器)
# if: |
# [ "$CNB_COMMIT_MESSAGE_TITLE" = "BUILD" ]
# image: tencentcom/rsync
# settings:
# user: ${SSH_USER}
# key: ${SSH_KEY}
# port: 22
# hosts:
# - ${ECS_IP}
# source: docs/.vitepress/dist/
# target: /root/rsync/rsync-vitepress/dist/
# delete: true
# prescript:
# - echo "prescript"
# - ls -l /root/rsync/rsync-vitepress/dist/
# script:
# - echo "after script"
# - ls -l /root/rsync/rsync-vitepress/dist/
# - date
# # - bash /root/website_music.sh
# - aliyun cdn RefreshObjectCaches --ObjectType File --ObjectPath "onedayxyy.cn/" #刷新阿里云cdn缓存
# - name: 🧘♂️ 刷新缓存
# image: docker.cnb.cool/znb/cdn-refresh
# settings:
# ak: "${TENCENT_OPSRE_AK}"
# sk: "${TENCENT_OPSRE_SK}"
# kind: "tencenteo"
# rtype: "path"
# domain: "onedayxyy.cn"
# urls:
# - "https://onedayxyy.cn/"
#同步仓库到gitee
- name: sync to gitee
image: tencentcom/git-sync
settings:
branch: master
auth_type: https
username: ${GIT_USERNAME}
password: ${GIT_ACCESS_TOKEN}
target_url: https://gitee.com/onlyonexl/vitepress-theme-teek-one-private.git
# git_email: 'github-actions[bot]@users.noreply.github.com'
- name: 🔔 发布通知
image: tencentcom/wecom-message
settings:
robot: ${WECOM_BOT}
msgType: markdown
content: |
> **🎉 One Blog 又一次发布成功啦!**
> **构建时间:** $CUSTOM_ENV_DATE_INFO
> **构建id:** $CNB_BUILD_ID
> **提交id:** $CNB_COMMIT_SHORT
> **构建分支:** $CNB_BRANCH
> **提交信息:** $CNB_COMMIT_MESSAGE_TITLE
> **提交者:** $CNB_COMMITTER
> **仓库地址:** [$CNB_REPO_URL_HTTPS]($CNB_REPO_URL_HTTPS)
> **我的网站:** [onedayxyy.cn](https://onedayxyy.cn/)
测试后配置
yaml
# .cnb.yml
$:
# vscode 事件:专供页面中启动远程开发用
vscode:
- runner:
# 自定义CPU核心数,最大支持64核
cpus: 64
docker:
# 自定义开发环境
build:
# 指定构建镜像的 Dockerfile 文件
dockerfile: .ide/Dockerfile
services:
# 声明使用 vscode 服务
- vscode
# 声明在容器中支持 docker 命令
- docker
imports:
- https://cnb.cool/onedayxyy/secret/-/blob/main/envs.yml
stages:
- name: 环境启动时执行以下命令
script:
# 安装pnpm并使用pnpm安装依赖
- npm install -g pnpm
- pnpm i
# 云原生构建流程和自动部署
master:
push:
# 增加 Docker 的 volumes 功能
"volume-cache":
name: 云原生构建
imports: https://cnb.cool/onedayxyy/secret/-/blob/main/envs.yml
runner:
# 自定义cpu核数 以支持构建更多文档(cpu最大64 内存会随cpuX2 128G内存)
cpus: 64
# 以下时gpu集群 这条和上面的只能选一个,gup集群cup固定32 内存最大96
# tags: cnb:arch:amd64:gpu
docker:
image: node:22
volumes:
- node_modules:copy-on-write
stages:
- name: set env
script: echo -n $(date "+%Y-%m-%d %H:%M")
exports:
info: CUSTOM_ENV_DATE_INFO
- name: 构建当前项目
script: npm install -g pnpm && pnpm i && pnpm run docs:build
- name: 部署到Pages
script: npx edgeone pages deploy ./docs/.vitepress/dist --name vitepress-theme-teek-one-private --token $EDGEONE_PAGES_API_TOKEN
# - name: 🧘♂️ 刷新缓存
# image: docker.cnb.cool/znb/cdn-refresh
# settings:
# ak: "${TENCENT_OPSRE_AK}"
# sk: "${TENCENT_OPSRE_SK}"
# kind: "tencenteo"
# rtype: "path"
# domain: "onedayxyy.cn"
# urls:
# - "https://wiki.onedayxyy.cn/"
# #同步仓库到gitee
# - name: sync to gitee
# image: tencentcom/git-sync
# settings:
# branch: master
# auth_type: https
# username: ${GIT_USERNAME}
# password: ${GIT_ACCESS_TOKEN}
# target_url: https://gitee.com/onlyonexl/vitepress-theme-teek-one-public.git
# git_email: 'github-actions[bot]@users.noreply.github.com'
- name: 🔔 发布通知
image: tencentcom/wecom-message
settings:
robot: ${WECOM_BOT}
msgType: markdown
content: |
> **🎉 One Blog 又一次发布成功啦!**
> **构建时间:** $CUSTOM_ENV_DATE_INFO
> **构建id:** $CNB_BUILD_ID
> **提交id:** $CNB_COMMIT_SHORT
> **构建分支:** $CNB_BRANCH
> **提交信息:** $CNB_COMMIT_MESSAGE_TITLE
> **提交者:** $CNB_COMMITTER
> **仓库地址:** [$CNB_REPO_URL_HTTPS]($CNB_REPO_URL_HTTPS)
> **我的网站:** [onedayxyy.cn](https://onedayxyy.cn/)
测试效果
上午:
晚上: