Merge pull request #2484 from alinobrasil/tools/thegraph #456
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Hosted PR and Dev/Prod Deployment | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
push: | |
branches: | |
- dev | |
- main | |
workflow_dispatch: | |
inputs: | |
environment: | |
required: false | |
type: choice | |
description: "Select the environment to deploy to (only required for production deployment)" | |
options: | |
- staging | |
- prod | |
jobs: | |
deploy: | |
if: | | |
(github.event_name == 'pull_request' && startsWith(github.head_ref, 'hosted/')) || | |
(github.event_name == 'push' && github.ref == 'refs/heads/dev') || | |
(github.event_name == 'push' && github.ref == 'refs/heads/main') || | |
(github.event_name == 'workflow_dispatch' && inputs.environment == 'prod') | |
uses: ./.github/workflows/build_and_deploy.yml | |
with: | |
environment: ${{ inputs.environment || | |
(github.ref == 'refs/heads/dev' && 'dev') || | |
(github.ref == 'refs/heads/main' && 'staging') || | |
(github.event_name == 'pull_request' && 'dev') || | |
'dev' }} | |
secrets: inherit |