Create Pages by Importing a GitHub Repository

更新时间:
复制 MD 格式

You can directly import a GitHub repository to quickly initialize and deploy a project using existing repository code.

Prerequisites

  • Functions and Pages is activated.

  • You have an active GitHub account and a code repository for storing Pages code.

Procedure

Pages integrates seamlessly with code management systems, enabling smooth synchronization between your development workflow and deployment process.

  1. Log on to the ESA console. In the left-side navigation pane, choose Edge Computing and AI > Functions and Pages.

  2. On the Edge Functions page, click Create.

  3. On the Import from GitHub Repo tab, click Add GitHub Account.

    image

  4. Log in to GitHub. On the authorization page, All repositories is selected by default. Click Install & Authorize to complete the repository authorization.image

  5. Configure the build information and click Start Deploy.

    Note

    After connecting your GitHub account, the repository list displays only public repositories by default. Private repositories are not shown automatically. To select a private repository, enter its name in the search box to search for it.

    image

    Configuration Type

    Feature

    Description

    Basic Configuration

    Production Branch

    Defaults to the main branch. Builds are automatically triggered based on the selected branch and deployed to the production environment.

    Non-Production Branch Build

    When enabled, new commits to non-production branches (e.g., branches other than main) generate build versions but are not automatically deployed.

    Install Command

    If dependencies need to be installed first, enter the command, such as npm install. Supports npm, yarn, cnpm, and pnpm.

    Build Command

    If a build step is required, enter the command, such as npm run build. Supports npm, yarn, cnpm, and pnpm.

    Advanced Configuration

    Root Directory

    The build command is executed in this directory. Default is /. For a monorepo, enter the path of the subproject to build (e.g., /frontend or /packages/web).

    Static Asset Directory

    The directory in the build output to be statically hosted, for example: ./public, ./dist, or ./build. You can specify the static asset directory in the assets.directory field of the esa.jsonc file. This configuration takes higher priority than the settings here.

    Function File Path

    The entry file path of the function, which is the file that is actually executed. For example: ./src/index.ts. You can specify the function file path in the entry field of the esa.jsonc file. This configuration takes higher priority than the settings here.

    Node.js Version

    The Node.js version used for building. After modifying this configuration, you must retrigger the build for it to take effect. You can specify the Node.js major version in the engines.node field of the package.json file. This configuration takes higher priority than the settings here.

    Environment Variables

    Environment variables that can be accessed during the build process. You can retrieve them through the global object process.env.

  6. After the build completes, a public domain link is generated for previewing your deployment.

    image

    image

Bind a custom domain name

After deployment, bind a custom domain to your project for easier access. Domain name configuration.