This example triggers a GitHub Action workflow that creates a deploy when a deploy ended webhook is received for a specific service. While this specific example GitHub Action triggers another deploy, you may also want to:
- Run end-to-end tests
- Clear a CDN cache to serve the latest content
- Notify a monitoring system about new deployment details
- Sync data or run other post deployment migrations
If you haven't already, sign up for a Render account. Creating webhooks on Render requires a Professional plan or higher. You can view and upgrade your plan in the Render Dashboard.
- Use the button below to deploy to Render
- Follow the Render documentation to create a webhook with the URL from your service and
/webhookpath that is triggered upon only theDeployEndedevent. Save the signing secret as theRENDER_WEBHOOK_SECRETenvironment variable. - Follow the Render documentation to create a Render API Key. Save the key as the
RENDER_API_KEYenvironment variable. - Follow the GitHub documentation to create a GitHub Action secret named
RENDER_API_KEYin your GitHub repo with the Render API key you created. - Follow the GitHub documentation to create a GitHub API token with read/write permissions for
Actions. Save the token as theGITHUB_API_TOKENenvironment variable. - Create a GitHub workflow with a dispatch trigger as shown in the example. You can check out Git Hub Actions Documentation for more information.
- Set the following environment variables:
RENDER_WEBHOOK_SECRETenvironment variable to the secret from the webhook created in step 2RENDER_API_KEYto the key created in step 3GITHUB_API_TOKENto the token created in step 4GITHUB_OWNER_NAMEto the owner of the GitHub repo the workflow is in (ex.render-examples)GITHUB_REPO_NAMEto the GitHub repo the workflow is in (ex.webhook-github-action)GITHUB_WORKFLOW_IDto the ID or filename of the workflow to trigger (ex.example.yaml)
- Trigger a service deploy and watch the GitHub workflow get triggered.
Once you've created a project and installed dependencies with pnpm install, start a development server:
pnpm run devpnpm run build