Gate deployments on successful CI from the main branch.
Section: Release and deployment workflows
Deploy only from main after tests
yaml
yaml
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo "run tests here"
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: production
steps:
- run: ./scripts/deploy.shExplanation
This pattern keeps deployment logic explicit and easy to reason about.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Release and deployment workflows