Skip to main content

Deployment

Deployment strategies

Standard launch & deployment strategy

All stores' live themes should be linked to GitHub branches using the Shopify GitHub integration.

The "main" store, typically the UK, should be connected to the master branch on GitHub. Any further stores should have their own branch added named Shopify-[country code]. An example of what this might look like is as below:

StoreGithub Branch
UKmaster
EUShopify-EU
USShopify-US
ROWShopify-ROW

All of these branches should be protected so they can't be deleted. You will need to ask Dan, Simon or Pat to set this up on the repo.

Deployments

Master store

You should always branch off the master branch when creating new features or hotfixes. Once the work has been completed these branches should be PR'd back into the master branch which will automatically push them onto the Main store.

Additional stores

Each project will have an npm script on it which can be run with npm run deploy:live. This should only be run while on the master branch. This will deploy all of the liquid & asset files to any stores listed in that script. It will ignore any JSON files to ensure content is not overwritten.

Here is what a typical script looks like as an example. You will see it manually ignores files instead of relying on the .shopifyignore file. This should be left purposefully minimal.

{
"scripts": {
"deploy:live": "shopify login --store=sunspel-us && npm run theme:push && shopify login --store=sunspel-eu && npm run theme:push && shopify login --store=sunspel-fr && npm run theme:push && shopify login --store=sunspel-de && npm run theme:push",
"theme:push": "shopify theme push -x 'package.json' -x 'package-lock.json' -x 'node_modules/' -x 'jsconfig.json' -x '.idea/' -x 'templates/*.json' -x 'templates/robots.txt.liquid' -x 'config/settings_data.json' -x 'locales/*.json'"
}
}

Alternative launch & deployment strategy

Sometimes the merchant will want to operate their store in a way where they are changing their live themes frequently. This, unfortunately, will mean we lose the ability to have a tight coupling of GitHub and the live theme on Shopify. If this is the case then we will operate on a "push & pull" strategy where GitHub is seen as the single source of truth as opposed to Shopify.

Given we won't be using the Shopify GitHub integration there will be no need to link any of the stores to GitHub. Their live theme will be rotating a lot there, so there would be no benefit.

Deployments

Master store

Prior to creating any new feature or hotfix branches, you will run the npm run theme:pull command. This is to ensure that our repo is kept as "up-to-date" as possible with any content and theme changes that are happening on the "main" store's live theme. An example of what that command looks like is as below. Note, it will also commit the pull for consistency.

{
"scripts": {
"theme:pull": "shopify login --store astridandmiyu && shopify theme pull -l && git add . && git commit -m 'Theme pull'"
}
}

Once the work has been completed these branches should be PR'd back into the master branch and then the npm run deploy:live command should be run.

Note: Any merchants running this strategy should have their "main" store added to the deploy:live command as all stores are deployed this way

Additional stores

With this strategy, additional stores are deployed to as part of the main deployment.