• Product Introduction
  • Quick Start
    • Importing a Git Repository
    • Starting From a Template
    • Direct Upload
    • Start with AI
  • Framework Guide
    • Frontends
      • Vite
      • React
      • Vue
      • Other Frameworks
    • Backends
    • Full-stack
      • Next.js
      • Nuxt
      • Astro
      • React Router
      • SvelteKit
      • TanStack Start
      • Vike
    • Custom 404 Page
  • Project Guide
    • Project Management
    • edgeone.json
    • Configuring Cache
    • Error Codes
  • Build Guide
  • Deployment Guide
    • Overview
    • Create Deploys
    • Manage Deploys
    • Deploy Button
    • Using Github Actions
    • Using CNB Plugin
    • Using IDE PlugIn
    • Using CodeBuddy IDE
  • Domain Management
    • Overview
    • Custom Domain
    • HTTPS Configuration
      • Overview
      • Apply for Free Certificate
      • Using Managed SSL Certificate
    • Configure DNS CNAME Record
  • Observability
    • Overview
    • Metric Analysis
    • Log Analysis
  • Pages Functions
    • Overview
    • Edge Functions
    • Cloud Functions
      • Overview
      • Node Functions
  • Middleware
  • KV Storage
  • Edge AI
  • API Token
  • EdgeOne CLI
  • Pages MCP
  • Message Notification
  • 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
      • Payload Integration
    • Authentication
      • Supabase Integration
      • Clerk Integration
  • Best Practices
    • Using General Large Model to Quickly Build AI Application
    • Use the DeepSeek model to quickly build a conversational AI site
    • Building an Ecommerce Platform with Shopify
    • 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 Github Actions

With this guide, you can quickly integrate the Actions workflow in your GitHub repository to enable automated build and deploy to EdgeOne Pages.

Set GitHub Repository Secrets

To run this Actions, you need to create repository Secrets in GitHub:
Access your GitHub repository webpage.
Go to Settings > Secrets and variables > Actions.
Click New repository secret.
Enter EDGEONE_API_TOKEN in "Name" and the EdgeOne API token value in "Secret".
To obtain EDGEONE_API_TOKEN, refer to the document API Token.

Deploying Trunk Code Changes

The complete .github/workflows/deploy.yml configuration is as follows:
name: Build and Deploy

# Trigger deployment on branch push to main trunk
on:
push:
branches:
- main

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.11.0' # select suitable Node.js version
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Deploy to EdgeOne Pages
run: npx edgeone pages deploy <outputDirectory> -n <projectName> -t ${{ secrets.EDGEONE_API_TOKEN }} [-e <env>]
env:
EDGEONE_API_TOKEN: ${{ secrets.EDGEONE_API_TOKEN }}
Configure the above deploy.yml file in your project root directory. When code is pushed to the main branch, it will trigger the following build process:
1. Check out to the target repository.
2. Set the Node.js version to 22.11.0.
3. Install project dependencies.
4. Build project.
After build complete, return to console view to check the build link, or go to Actions > All workflows > Build and Deploy in the current repository to view the Deploy to EdgeOne Pages node.
workflow_deploy_pagas
workflow_deploy_pagas


Deploying Preview URL before Code Merge

The complete .github/workflows/deploy.yml configuration is as follows:

name: Build and Deploy

on:
pull_request_target:
types: [opened]

jobs:
Deploy-Preview:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.11.0' # select suitable Node.js version

- name: Install dependencies
run: npm install
- name: Build project
run: npm run build

- name: Deploy to EdgeOne Pages
id: deploy
run: |
echo "Deploying to EdgeOne Pages..."
DEPLOY_OUTPUT=$(npx edgeone pages deploy ./.next -n next-mix-render-template -t ${{ secrets.EDGEONE_TOKEN }} -e preview 2>&1)
DEPLOY_URL=$(echo "$DEPLOY_OUTPUT" | grep "EDGEONE_DEPLOY_URL=" | cut -d'=' -f2-)
echo "DEPLOY_URL=$DEPLOY_URL" >> $GITHUB_OUTPUT
PROJECT_ID=$(echo "$DEPLOY_OUTPUT" | grep "EDGEONE_PROJECT_ID=" | cut -d'=' -f2-)
echo "PROJECT_ID=$PROJECT_ID" >> $GITHUB_OUTPUT

DEPLOY_END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "DEPLOY_END_TIME=$DEPLOY_END_TIME" >> $GITHUB_OUTPUT

env:
EDGEONE_API_TOKEN: ${{ secrets.EDGEONE_TOKEN }}

- name: Enable PR comments # Support preview URL deployment before code merge
uses: thollander/actions-comment-pull-request@v2
with:
message: |
🚀 **EdgeOne Pages deployment complete**
| Project | Preview Link | Project ID | Update Time |
|---|---|---|---|
| [${{ github.event.repository.name }}](https://console.tencentcloud.com/edgeone/pages/project/${{ steps.deploy.outputs.PROJECT_ID }}/deploy) | [🔗 Click to Preview](${{ steps.deploy.outputs.DEPLOY_URL }}) | ${{ steps.deploy.outputs.PROJECT_ID }} | ${{ steps.deploy.outputs.DEPLOY_END_TIME }} |
Configure the above deploy.yml file in your project root directory. When a pull request is created, it will trigger the following build process:
1. Check out to the target repository.
2. Set the Node.js version to 22.11.0.
3. Install project dependencies.
4. Build project.
5. The pull request comment area will display EdgeOne deployment successful information. You can review page changes before merging code.



Note:
npx edgeone pages deploy parameter description:
<outputDirectory>: The folder where the project build product is located (required).
-n, --name: The project name to be deployed. A new project will be created automatically if it does not exist (required).
-e, --env: The target environment to deploy. Available values: production or preview (default production).
Example: npx edgeone pages deploy ./dist -n project-name -t ${{ secrets.EDGEONE_API_TOKEN }}.

EdgeOne Pages Deployment

After build complete, the project will be deployed to EdgeOne Pages via the following steps:
Build stage generates ./out directory
Use the EdgeOne command line tool to deploy: npx edgeone pages deploy ./out -n my-edgeone-pages-project -t ${{ secrets.EDGEONE_API_TOKEN }}
GitHub Actions relevant information is viewable in documentation.

ai-agent
私に尋ねることができます、例えば
EdgeOne Pagesの使用を開始するには?