Skip to content

Commit

Permalink
Added validation for pipeline trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandhya1874 committed Dec 4, 2024
1 parent 1a74448 commit f5a5de0
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,47 @@ jobs:
push: true
secrets: inherit

deploy_to_dev:
deploy_to_dev_on_workflow_dispatch:
name: Deploy to dev
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'development'
uses: ./.github/workflows/deploy.yml
needs: build
needs:
- build
with:
environment: development
version: ${{ needs.build.outputs.version }}
secrets: inherit

deploy_to_prod:
deploy_to_prod_on_workflow_dispatch:
name: Deploy to prod
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production' && github.event.inputs.branch == 'main'
uses: ./.github/workflows/deploy.yml
needs:
- build
- deploy_to_dev # wait for the deploy_to_dev job to complete
with:
environment: production
version: ${{ needs.build.outputs.version }}
secrets: inherit

deploy_to_dev_on_push_to_main:
name: Deploy to dev on push to main
if: github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main' && github.event.action == 'closed' && github.event.pull_request.merged == true
uses: ./.github/workflows/deploy.yml
needs:
- build
with:
environment: development
version: ${{ needs.build.outputs.version }}
secrets: inherit

deploy_to_prod_on_push_to_main:
name: Deploy to prod on push to main
if: github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main' && github.event.action == 'closed' && github.event.pull_request.merged == true
uses: ./.github/workflows/deploy.yml
needs:
- build
- deploy_to_dev_on_push_to_main # wait for the deploy_to_dev job to complete
with:
environment: production
version: ${{ needs.build.outputs.version }}
secrets: inherit

0 comments on commit f5a5de0

Please sign in to comment.