This is a Next.js template project that uses GitHub Actions for building and deployment to EdgeOne Pages.
This project provides a starter template for Next.js applications, integrating GitHub Actions workflows and automatic deployment functionality.
Complete .github/workflows/deploy.yml
configuration is as follows:
name: Build and Deploy
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: 20
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Deploy to EdgeOne Pages
run: npx edgeone pages deploy ./out --name my-edgeone-pages-project --token ${{ secrets.EDGEONE_API_TOKEN }}
env:
EDGEONE_API_TOKEN: ${{ secrets.EDGEONE_API_TOKEN }}
This project uses GitHub Actions for automated building. When code is pushed to the main branch, it triggers the following build process:
- Checkout the repository code
- Setup Node.js 20 environment
- Install project dependencies
- Build the project using Next.js
After the build completes, the project is automatically deployed to EdgeOne Pages through the following process:
- The build phase generates the
./out
directory - The EdgeOne command line tool is used for deployment:
npx edgeone pages deploy ./out --name my-edgeone-pages-project --token ${{ secrets.EDGEONE_API_TOKEN }}
To deploy to EdgeOne Pages, you need to add your EDGEONE_API_TOKEN
as a repository secret in GitHub:
- Navigate to your GitHub repository
- Go to "Settings" > "Secrets and variables" > "Actions"
- Click "New repository secret"
- Name:
EDGEONE_API_TOKEN
- Value: Your EdgeOne API token
Obtain your EDGEONE_API_TOKEN
from EdgeOne Pages by visiting: https://edgeone.ai/document/177158578324279296
- EdgeOne Pages Documentation: https://edgeone.ai/document/160427672992178176
- GitHub Actions Documentation: https://docs.github.com/en/actions