-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable staging deployment #42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work man, real good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved assuming the present TODOs are taken care of before merging
if [ "${CIRCLE_BRANCH}" = 'master' ]; then # https://stackoverflow.com/a/2013589/3482533 | ||
~/.local/bin/ditto transform --base-url='https://pokeapi.co' --src-dir=data --dest-dir=_gen | ||
elif [ "${CIRCLE_BRANCH}" = 'staging' ]; then | ||
~/.local/bin/ditto transform --base-url='https://pokeapi-test-b6137.firebaseapp.com' --src-dir=data --dest-dir=_gen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming Bash 4 is available on the host, I'd organize this with something like this (untested):
also rename the file to .bash instead of .sh if you do this to make it obvious it uses bash syntax
#!/usr/bin/env bash
declare -A BRANCH_TO_URL=(
["master"]="https://pokeapi.co"
["staging"]="https://pokeapi-test-b6137.firebaseapp.com"
)
BASE_URL="${BRANCH_TO_URL[$CIRCLE_BRANCH]}"
~/.local/bin/ditto transform --base-url="$BASE_URL" --src-dir=data --dest-dir=_gen
This PR allows invoking in a conditional manner a new deploy job present in the
PokeAPI/deploy
CircleCI configuration. This job will automatically deploy theapi-data
data to our productive environment (pokeapi.co) or to a new staging environment. The job will be invoked only when themaster
orstaging
branches of this repository are pushed to. If themaster
is getting pushed then themaster
branch will be deployed in the productive environment. Viceversa, if thestaging
branch is pushed, then thestaging
branch will be deployed in the staging environment.A more descriptive and general overview is detailed in this PokeAPI/pokeapi#488 PR.
This PR is linked to the following PRs:
When PokeAPI/deploy#10 will be merged we need to change
.circleci/config.yml#38
,updater/cmd.bash#33
,updater/cmd.bash#36
This PR should be merged after PokeAPI/deploy#10