The Deploy to Edgio button lets users easily clone and deploy an example project to Edgio. Under the hood the platform will clone the example to the user’s GitHub account and leverage GitHub Actions to deploy to it to their personal Edgio account.
This guide walks you through some deploy button examples and how you can set up a GitHub repository for your users to deploy to Edgio with a simple click.
Example
An example Deploy Button using the following HTML snippet.
Snippets
Use the snippets below in your Git repository to enable users to deploy the repository directly to Edgio.
1[![Deploy with Edgio](https://docs.edg.io/button.svg)](https://edgio.app/deploy?repo=https://github.com/edgio-docs/edgio-nextjs-example)
Creating Your Own Deploy Button
To configure your own project to be deploy button ready, there’s a few steps to take.
- First, your project needs to already be configured and initialized with Edgio. See our Getting Started guide for initial setup.
- Next, create a basic
deploy
script as described below. Typically, this can simply beedgio deploy
, but if your site requires additional processing outside of the standard Edgio build/deploy process, you will need to modify this script to include the necessary steps to make your site production-ready. - Create a GitHub workflow as described below. This makes sure GitHub Actions is properly configured to build the project.
Add deploy
Script to package.json
1// additional scripts may need to be called based on your app build process2"deploy": "edgio deploy",
Lastly, create a GitHub workflow file called edgio.yml
. This will be triggered automatically by Edgio during the deploy process.
Create .github/workflows/edgio.yml
Workflow
1name: Deploy to Edgio23on:4 push:5 workflow_dispatch:67jobs:8 deploy-to-edgio:9 runs-on: ubuntu-latest10 steps:11 - uses: actions/checkout@v312 - uses: actions/setup-node@v313 with:14 node-version: 1415 - run: npm ci16 - run: npm run deploy -- --token=$EDGIO_DEPLOY_TOKEN17 env:18 EDGIO_DEPLOY_TOKEN: ${{secrets.EDGIO_DEPLOY_TOKEN}}
secrets.EDGIO_DEPLOY_TOKEN
is automatically injected into your cloned repository during the deploy process. Do not change the name of this variable or the deploy process will fail.
Once everything is setup, you can test your deploy button by appending your GitHub repository full URL to https://edgio.app/deploy?repo=
.
For example, using our Next.js example located at https://github.com/edgio-docs/edgio-nextjs-example
would become https://edgio.app/deploy?repo=https%3A%2F%2Fgithub.com%2Fedgio-docs%2Fedgio-nextjs-example
Now, you can embed this link to let users instantly clone and deploy the project to Edgio!