Use the edgeone command-line tool to deploy EdgeOne Pages static websites.
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]
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
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
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