By following the guidelines in this section, you can quickly integrate an Actions workflow into your GitHub repository to automatically build and deploy to EdgeOne Makers.
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
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 the build is complete, return to the console to view the build link, or navigate to Actions > All workflows > Build and Deploy in the current repository to view the Deploy to EdgeOne Makers node.
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