This post explains a simple GitHub action to deploy your frontend app to surge for each pull request created.
This post assumes you already have surge
installed and logged in.
Now, let’s generate a new surge token
surge token
Add the generated token to Github secrets so that GitHub actions can use it.
Next, add the following action into .github/workflows
.
This will action will get triggered when a pull request is created/updated and merged to the main.
We use the pull request id in the URL for each review app like my-app-1.surge.sh
for the review apps and when we merge the pull request to main it will deploy to my-app-main.surge.sh
Hope that helped.