Deploy a commit
By default, once you’ve connected your GitHub or GitLab account to your Render account, Render will automatically build and deploy your services with every code push to your remote repository.
This behavior means that without performing complicated git operations, only the most recent commit of a configured git branch or a previously built commit can be deployed to your Render services. To preview the changes in a feature branch, you can use a Preview Environment or Pull Request Previews. These options however are again by default limited to deploying only the head of the feature branch or rolling back to a previously deployed commit.
This guide will show you how to deploy any commit in your GitHub or GitLab repository to Render, regardless of if it is the head of a branch or has been previously deployed.
Deploying a commit manually
To manually deploy any commit in your GitHub or GitLab repository, use the Manual Deploy button for that service in the Render Dashboard.
Select the Deploy a specific commit option, select the commit to be deployed in the resulting modal, and then click the Deploy button.
A new build of that commit will start and will be subsequently deployed to your service.
Manually deploying a commit this way will disable Auto-Deploys for the service. You will need to toggle Auto-Deploys back on for the service via your Render Dashboard.
Toggling Auto-Deploys back on will cause your service to once again automatically deploy the head of your configured git branch on every code push to that branch.
Deploying a commit via webhook
Render offers a Deploy Hook that can be used to trigger a build and deployment
of your service without needing to push code to your GitHub or GitLab repository, for example as a step in your CI/CD
pipeline. By adding a ref
parameter to the URL of your deploy hook with a value of the git
commit SHA to be deployed, you can deploy a particular commit to your service via your deploy hook.
The value of the ref
parameter can be either the complete SHA of the commit or the short
version. For example, to deploy the commit with the full SHA baaa339926cb474b61c1f0e6297b024eaa09ac7d
, either of the
following Deploy Hook URLs can be used:
https://api.render.com/deploy/srv-XXYYZZ?key=AABBCC&ref=baaa339926cb474b61c1f0e6297b024eaa09ac7d
https://api.render.com/deploy/srv-XXYYZZ?key=AABBCC&ref=baaa339
The response to a GET
or POST
to this Deploy Hook URL will return an HTTP 200 OK
response if the provided git SHA
is valid and a build of that commit is begun. An HTTP 404 Not Found
will be returned if the provided git SHA is
invalid.
Additional resources
Deploying a specific commit in this is not intended to
replace Preview Environments
or Pull Request Previews. Using these deployment methods to preview
changes provide a unique onrender.com
URL that is served over HTTP/2 and full TLS.
Additionally, Preview Environments create a clone of your entire
production environment (including services, databases, and environment groups) and can be used to perform end-to-end
testing of changes in a non-production environment.