feat: deploy staging branch to staging env

This commit is contained in:
Alessandro Pezzè 2020-05-03 17:16:02 +02:00
parent b7902ee3d0
commit 44acf889e6
2 changed files with 14 additions and 10 deletions

View file

@ -16,7 +16,7 @@ jobs:
name: Run tests name: Run tests
command: make test command: make test
generate_data_and_trigger_pullrequest_deploy: deploy:
machine: machine:
image: ubuntu-1604:201903-01 # https://circleci.com/docs/2.0/configuration-reference/#available-machine-images with Docker 18.09.3 image: ubuntu-1604:201903-01 # https://circleci.com/docs/2.0/configuration-reference/#available-machine-images with Docker 18.09.3
steps: steps:
@ -25,17 +25,19 @@ jobs:
fingerprints: fingerprints:
- "d3:5f:9d:68:ea:12:9a:42:d3:d3:e1:db:b0:6a:fc:d2" - "d3:5f:9d:68:ea:12:9a:42:d3:d3:e1:db:b0:6a:fc:d2"
- run: - run:
name: Generate new data, push to PokeAPI/api-data's staging branch and open a Pull Request towards PokeAPI/api-data's master branch name: Generate new data, push to PokeAPI/api-data's staging branch, if master open a Pull Request towards PokeAPI/api-data's master branch
command: bash -x Resources/scripts/updater.sh command: bash -x Resources/scripts/updater.sh
workflows: workflows:
version: 2 version: 2
test-and-generate_data_and_trigger_pullrequest_deploy: test-and-deploy:
jobs: jobs:
- test - test
- generate_data_and_trigger_pullrequest_deploy: - deploy:
requires: requires:
- test - test
filters: filters:
branches: branches:
only: master only:
- master
- circleci-hook # TODO: change to staging

View file

@ -197,9 +197,11 @@ clone
notify_engine_pr "start" notify_engine_pr "start"
run_updater run_updater
check_remote_branch "$branch_name" check_remote_branch "$branch_name"
sleep 300 # 5 minutes, the time it takes for CircleCI's api-data script to generate the data and for CircleCI's deploy script to deploy it to the staging environment if [ "$CIRCLE_BRANCH" = 'master' ]; then
check_remote_branch "$branch_name" sleep 300 # 5 minutes, the time it takes for CircleCI's api-data script to generate the data and for CircleCI's deploy script to deploy it to the staging environment
data_repo_pr_number=$(create_pr) check_remote_branch "$branch_name"
customize_pr "$data_repo_pr_number" data_repo_pr_number=$(create_pr)
add_reviewers_to_pr "$data_repo_pr_number" customize_pr "$data_repo_pr_number"
add_reviewers_to_pr "$data_repo_pr_number"
fi
cleanexit 0 'Done' cleanexit 0 'Done'