Q18
How do you construct a pipeline that deploys to staging first, and then to production only if staging succeeds?
💬Answer
Configure dependent jobs using the needs keyword and target environments:
jobs:
deploy-staging:
runs-on: ubuntu-latest
environment: staging
steps:
- run: echo "Deploying to Staging..."
deploy-prod:
runs-on: ubuntu-latest
needs: deploy-staging
environment: production
steps:
- run: echo "Deploying to Production..."
Related GitHub Actions Questions
View All GitHub ActionsQuestions →Q1
What is GitHub Actions, and how does it process workflows under the hood?
Q2Can you list and explain the key architectural components of GitHub Actions?
Q3How do you configure workflow triggers, and what is the syntax for defining manual execution parameters?
Q4What is a matrix strategy in GitHub Actions, and in what scenarios would you use it?

Created by
Apurv Gujjar
DevOps & Cloud Engineer
Specialized in:DevOpsAWSGCPKubernetesTerraformDocker
View Portfolio