โShow me how to trigger a Render deploy from GitHub Actions using a deploy hook URL stored as a secret, only after my publish job succeeds, using needs: to chain jobs.โ
08 โ Deploy automatically when you merge to main
Category: Continuous Deployment ยท Priority: High ยท Step: 9
Close the loop: a successful merge to
maintriggers a deploy. This is full CD.
๐ฏ What is this task?
You've built, tested, and published. The final piece is deployment: when code lands on main and the image is published, automatically tell your host (e.g. Render from Project 1) to pull the new image and go live โ with zero manual steps.
๐ Builds on: Project 1 Render deploy + lesson 06 (publish to GHCR).
๐ค AI Prompt
"Show me how to trigger a Render deploy from GitHub Actions using a deploy hook URL stored as a secret, only after my publish job succeeds. Use
needs:to chain jobs."
๐ Step-by-step
Chain a deploy job after publish using needs::
deploy:
runs-on: ubuntu-latest
needs: publish # only run if publish succeeded
if: github.ref == 'refs/heads/main'
steps:
- name: Trigger Render deploy
run: curl -fsSL "${{ secrets.RENDER_DEPLOY_HOOK }}"
needs: publishโdeploywaits forpublishand runs only if it passed.RENDER_DEPLOY_HOOKis a secret URL from Render โ Settings โ Deploy Hook.- Hitting that URL tells Render to pull the latest image and redeploy.
The full pipeline now: push โ test โ build โ publish โ deploy, all automatic. That's CI/CD.
โ Done when
- A
deployjob runs only afterpublishsucceeds (needs:) - Merging to
mainupdates the live site with no manual steps - You can describe the full push-to-production pipeline end to end
๐ Quiz
Answer all 2 questions correctly to complete this lesson.