Skip to content

Commit

Permalink
Added validation for pipeline trigger (#50)
Browse files Browse the repository at this point in the history
* Added validation for pipeline trigger

* Update pipeline.yml

Added name description for workflow dispatch part
  • Loading branch information
Sandhya1874 authored Dec 4, 2024
1 parent 1a74448 commit 89afee9
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,46 @@ jobs:
push: true
secrets: inherit

deploy_to_dev:
name: Deploy to dev
deploy_to_dev_on_workflow_dispatch:
name: Deploy to dev on manual workflow dispatch
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_on_workflow_dispatch:
name: Deploy to prod on manual workflow dispatch
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production' && github.event.inputs.branch == 'main'
uses: ./.github/workflows/deploy.yml
needs:
- build
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:
name: Deploy to prod
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 # wait for the deploy_to_dev job to complete
- deploy_to_dev_on_push_to_main # wait for the deploy_to_dev job to complete
with:
environment: production
version: ${{ needs.build.outputs.version }}
Expand Down

0 comments on commit 89afee9

Please sign in to comment.