logo
0
0
WeChat Login
feat: 支持插件变量方式部署并重构CI配置

Deploy EdgeOne Pages Plugin

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

Prerequisites

  • EdgeOne Pages API Token obtained

Usage

This plugin supports two usage modes: Settings Mode and Script Mode.


Mode 1: Settings Mode

Pass parameters via settings, and the plugin will automatically execute the deployment command without manually writing scripts.

Parameters

ParameterRequiredDescriptionDefault
project_nameEdgeOne Pages project name-
api_tokenEdgeOne Pages API Token-
directoryDeployment directory path.
environmentDeployment environment, preview for staging, empty for productionproduction

Staging Environment Example

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 to staging
        image: tencentcom/deploy-eopages:latest
        settings:
          project_name: landing-page-demo
          api_token: $EDGEONE_PAGES_API_TOKEN
          directory: ./dist
          environment: preview

Production Environment Example

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 to production
        image: tencentcom/deploy-eopages:latest
        settings:
          project_name: landing-page-demo
          api_token: $EDGEONE_PAGES_API_TOKEN
          directory: ./dist

Mode 2: Script Mode

Write custom edgeone commands directly using script, suitable for scenarios requiring flexible control over the deployment process.

Script Staging Environment Example

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

Script Production Environment Example

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

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

Secret Management

API Token is sensitive information. It's recommended to store it in a secret repository and reference it in the pipeline:

# envs.yml
EDGEONE_PAGES_API_TOKEN: mRH1***wu0C

Reference Documentation