Render
Emanates also supports deploying to Render.
#
Before you beginA Render project needs to be setup before starting with the deployment.
#
Add ProjectFollow the following steps to add a project
- Signup/Login on Render and click on the New + button on top in the navbar.
- Now select Static Site from the dropdown.
- Render will ask you to choose a repository from GitHub. If you have not given Render access to GitHub, click on the GitHub icon and give Render access to the repository you created from the template repository.
#
Configure the projectNow that we have selected the repo, we need to configure the project to work as we want it to work.
Set a Name for the project. Leave everything as is and scroll down to the Advanced Section.
Click on the Advanced button and follow the following steps:
- Click on Add Environment Variable and add the following variables:
EMANATES_TOKEN
: The token generated in the Getting Started step.REPO
: Your repo in the form ofusername/reponame
.
- Set the Auto Deploy value to No.
Finally, click on the Create Static Site button.
#
ActionFor the GitHub Action, we actully don't need to use any external package to push to Render
. It's harder to setup a proper deployment pipeline for Render since the app already does everything and there were no packages explicitly pushing the builds.
So rather, we will go for a deployment hook method in order to run the deployment everytime a new post is added/deleted/updated.
Doing this will be extremely simpler as compared to setting up a pipeline where the deployment is invoked through GitHub Action explicitly.
#
Deployment HookRender automatically creates a deployment hook when the project is created. Just follow the steps below to get the hook URL:
- Click on Setting on the top of your project.
- Click on the copy button next to the Deploy Hook option.
#
Save the URLNow that we have the URL, we need to set it up as a GitHub Secret. You can read here about setting up GitHub secrets in your repo.
Go to your emanates repository and then go to Settings, then Secrets.
Name it RENDER_HOOK_URL
, set the copied value from the above step and save it.
#
Deployment CodeNow that we have the required things setup, the deployment code can now be setup in the .github/workflows
directory inside the repository.
Below is the deploy.yml
file that you need to add in the .github/workflows
directory on your repository.
warning
If there is already a deploy.yml
file in that repo, replace it with the below one!
name: 'Emanates Deploy'
on: issues: types: [opened, edited, deleted]
jobs: # Deploy to Render deploy: name: 'Deploy to Render' runs-on: ubuntu-latest
steps: - name: Call the deployment hook uses: wei/curl@master with: args: -X POST ${{ secrets.RENDER_HOOK_URL }}
Once you save the above file, it's time to create a new blog post.
Go to your issues tab and create a new issue. Once you click on the issue create
button, this action file will be invoked by GitHub and your site will start building.
If everything goes well (which it should), you'll be able to see your site on your Render site address.