I have created multiple worflow files to deploy in different environments based on the following condition
- Deploy to QA server, when push on
qa
branch - Deploy to Staging server, when push on
staging
branch
The workflow files are
qa-deploy.yml
name: Deploy to QA
on:
push:
branches:
- qa
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
jobs:
test:
name: Testing
runs-on: ubuntu-latest
staging-deploy.yml
name: Deploy to Staging
on:
push:
branches:
- staging
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
But when pushes are made to the qa
branch, staging workflow is also executed and gives the following error
Error: .github#L1
No event triggers defined in `on`
while I want the pipeline to execute only when pushes are made to the respective branch only.