GitHub Actions Workshop

Master GitHub Actions with hands-on labs and exercises. Learn how to automate workflows, run tests, deploy applications, and more using GitHub's powerful automation platform. This repository has everything you need to get started with continuous integration and continuous deployment.


Project maintained by prasadhonrao Hosted on GitHub Pages — Theme by mattgraham

Solution : Deployment Protection Rules

name: Env - Deployment Protection Rule

on:
  push:
    branches:
      - main

jobs:
  deploy-to-dev:
    runs-on: ubuntu-latest
    environment: dev
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Deploy to Dev
        run: echo "Deploying to the dev environment."

  deploy-to-prod:
    needs: deploy-to-dev
    runs-on: ubuntu-latest
    environment: prod
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Deploy to Prod
        run: echo "Deploying to the prod environment."