Building from specific branch and building after merging to master
Currently I have a master branch and a development branch. I want the build process to be triggered only if anything is merged to dev branch and I have already added "only" reference. Once all the work is done on dev branch I merged the dev branch to master which did not trigger any build. Is there a way to trigger build both ways,
- when any feature branch is merged to dev branch
- When that dev branch is merged to master (since master is what goes into PROD)
Below is my sample gitlab CI file:
image: docker:latest
stages:
- cloning
- build
- deploy
cloning:
stage: cloning
only:
- DEV
script:
- echo "Starting to clone the repo...."
- echo $PATH
- pwd
- ls -l
- echo "Moving to next stage"
build:
stage: build
only:
- DEV
script:
- echo "Starting the build Process..."
- pwd
- echo "Build process completed.."
deploy:
stage: deploy
when: manual
only:
- master
script:
- echo "Deploy to DEV.."
- pwd
- echo "Deployment complete.."