Conversation
This was referenced May 2, 2020
sargunv
approved these changes
May 10, 2020
Member
sargunv
left a comment
There was a problem hiding this comment.
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 |
Member
There was a problem hiding this comment.
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 file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows invoking in a conditional manner a new deploy job present in the
PokeAPI/deployCircleCI configuration. This job will automatically deploy theapi-datadata to our productive environment (pokeapi.co) or to a new staging environment. The job will be invoked only when themasterorstagingbranches of this repository are pushed to. If themasteris getting pushed then themasterbranch will be deployed in the productive environment. Viceversa, if thestagingbranch is pushed, then thestagingbranch 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#36This PR should be merged after PokeAPI/deploy#10