Shopify / slate

Slate is a toolkit for developing Shopify themes. It's designed to assist your workflow and speed up the process of developing, testing, and deploying themes.
https://shopify.github.io/slate
MIT License
1.28k stars 364 forks source link

Possibility to deploy to different env with travis #962

Open JulienHe opened 5 years ago

JulienHe commented 5 years ago

Problem

Having the possibility to deploy to multiple environment based on the branch. I want to deploy to a specific Slate theme when I use a different branch, automatically.

Replication steps

Create a skeleton slate theme with 2 .env - production and staging and make the build verified by travis.

- if [ "$TRAVIS_BRANCH" = "staging" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ];
  then yarn deploy --env=staging --skipPrompts;
  else yarn build --skipPrompts;
  fi

Travis will come with this error : Error: ENOENT: no such file or directory, open '/home/travis/build/ultrasupernew/Gugusleep-shop/shop/.env.staging'

More Information

If you have any hint that will be awesome!

t-kelly commented 5 years ago

.env contain API credentials and should not be commited to Git or in CI. You should use environment variables in TravisCI to set the values of .env. You can create a bash script in TravisCI that chooses which environment variable to use based on the branch.