Edge Developer Platform
  • Pages
    • Product Introduction
    • Quick Start
      • Importing a Git Repository
      • Starting From a Template
      • Direct Upload
    • Framework Guide
    • Project Guide
      • Project Management
      • edgeone.json
      • Configuring Cache
      • Error Codes
    • Build Guide
    • Deployment Guide
      • Overview
      • Create Deploys
      • Manage Deploys
      • Deploy Button
      • Use Github Actions
      • Using CNB Plugin
      • Using IDE Plug-In
      • Using CodeBuddy IDE
    • Domain Management
      • Overview
      • Custom Domain Name
      • Configuring an HTTPS Certificate
      • How to Configure a DNS CNAME Record
    • Pages Functions
    • KV Storage
    • Edge AI
    • API Token
    • EdgeOne CLI
    • Pages MCP
    • Integration Guide
      • AI
        • Dialogue Large Models Integration
        • Large Models for Images Integration
      • Database
        • Supabase Integration
        • Pages KV Integration
      • Ecommerce
        • Shopify Integration
        • WooCommerce Integration
      • Payment
        • Stripe Integration
        • Integrating Paddle
      • CMS
        • WordPress Integration
        • Contentful Integration
        • Sanity Integration
      • Authentication
        • Supabase Integration
        • Clerk Integration
    • Best Practices
      • Using General Large Model to Quickly Build AI Application
      • Use the Deepseek-R1 model to quickly build a conversational AI site
      • Building an Ecommerce Platform with WordPress + WooCommerce and GatsbyJS
      • Building a SaaS Site Using Supabase and Stripe
      • Building a Company Brand Site Quickly
      • How to Quickly Build a Blog Site
    • Migration Guides
      • Migrating from Vercel to EdgeOne Pages
      • Migrating from Cloudflare Pages to EdgeOne Pages
      • Migrating from Netlify to EdgeOne Pages
    • Troubleshooting
    • FAQs
    • Contact Us
    • Release Notes

Using CNB Plugin

With this section's guide, you can quickly integrate Cloud Native Build (CNB) into the process for automated build and deploy to EdgeOne Pages.


Configuring a Private Key

Retrieve EDGEONE_API_TOKEN from Pages. For the method for obtaining, see the referenced document API Token.
Use the CNB key repository for storage, then refer to it in the pipeline. The envs.yml content is as follows:
EDGEONE_API_TOKEN: oJTlMUq9**********NYzKFIw=

The complete .cnb.yml is configured as follows:
# trigger: push to master branch
main:
push:
# Import environment variables from private repository:
# See: https://docs.cnb.cool/en/build/env.html#importing-environment-variables
- imports: https://cnb.cool/***/-/blob/main/envs.yml
stages:
# Build Current Project
- name: Build Current Project
image: node:20
script: node -v && npm install && npm run build
# Deploy build output to EdgeOne Pages
# The ./dist directory is generated in the previous build step
# See: https://www.npmjs.com/package/edgeone
- name: Deploy to EdgeOne Pages
image: node:20
script: npx edgeone pages deploy <outputDirectory> -n <projectName> -t $EDGEONE_API_TOKEN
Note:
npx edgeone pages deploy Parameter description:
<outputDirectory>: The folder where the project build product is located (required)
-n, --name: Project name that needs to be deployed. If the project does not exist, a new project will be created automatically (required)
-e, --env: Deployment target environment. Available values: production or preview (default production)

Example: npx edgeone pages deploy ./dist -n project-name -t $EDGEONE_API_TOKEN


Cloud Native Build (CNB)

When code is pushed to the main branch, it triggers the following build process:
1. Import required environment variables
2. Build the project using Node.js 20 environment
3. Deploy build output to Pages


Deploying EdgeOne Pages

The project will be automatically deployed to Pages through the following process after build complete.
1. Generate the ./dist directory in the build stage
2. Use EdgeOne command line tool edgeone pages deploy to deploy.