logo
11
12
WeChat Login

Deploy EdgeOne Pages Plugin

Use the edgeone command-line tool to deploy EdgeOne Pages static websites.

Prerequisites

  • An existing EdgeOne account with a Pages project created, note that this project must be of the Direct Upload type
  • EdgeOne Pages API Token obtained

Deployment Process Description

1. Introduction

This plugin uses the edgeone command-line tool to deploy EdgeOne Pages static websites, with the basic usage as follows:

edgeone pages deploy <directoryOrZip> -n <projectName> -t <API_TOKEN> [-e preview]

2. Environment Deployment Configuration

edgeone pages provides both staging and production environments, which perfectly align with cnb's custom deployment functionality. You can configure environments in .cnb/tag_deploy.

environments:
  - name: staging
    description: staging environment deployment
  - name: production
    description: production environment deployment
    require:
      - environmentName: staging
        after: 60

Then configure the corresponding trigger events in .cnb.yml. Please replace EDGEONE_PAGES_API_TOKEN with your actual API Token.

API Token is generally sensitive information, so it's recommended to store it in a secret repository and reference it in the pipeline. The content is as follows:

# envs.yml
EDGEONE_PAGES_API_TOKEN: mRH1***wu0C

Staging Environment Deployment

Triggered by tag_deploy.staging, deploys to the staging environment:

tag_deploy.staging:
  - imports: https://cnb.cool/***/-/blob/main/envs.yml
  - stages:
      - name: build
        image: node:20-alpine
        script: npm install && npm run build
      - name: Deploy my eo pages staging environment
        image: tencentcom/deploy-eopages:latest
        script: |
          edgeone pages deploy .dist -n landing-page-demo -e preview -t $EDGEONE_PAGES_API_TOKEN

Production Environment Deployment

Triggered by tag_deploy.production, deploys to the production environment:

tag_deploy.production:
  - imports: https://cnb.cool/***/-/blob/main/envs.yml
    stages:
      - name: build
        image: node:20-alpine
        script: npm install && npm run build
      - name: Deploy my eo pages production environment
        image: tencentcom/deploy-eopages:latest
        script: |
          edgeone pages deploy ./dist -n landing-page-demo -t $EDGEONE_PAGES_API_TOKEN

Reference Documentation

About

一个部署 edgeone pages 的 cnb 插件。