Multiple Stores using Same Github Branch

Solved
MatthewG
Shopify Partner
6 1 7

Hi,

 

I am using Shopify Online Store 2.0 with Github integration. I am wanting to use one master branch that will be used across multiple stores. All the stores will be identical with small changes being made with liquid conditions.

 

This all works fine apart from the theme settings config files. I want a unique settings_data.json file for each site as the sites will have different content, but with the same codebase. When I make a change in the theme settings it then pushes this change to Github which then updates the theme settings for all the other sites.

 

What is the best approach for dealing with this? Does anyone have a workflow strategy that they can share that solves this issue?

 

Any ideas?

 

Thanks,

Matt

Accepted Solution (1)
MatthewG
Shopify Partner
6 1 7

This is an accepted solution.

@RossellaF The solution I ended up coming up with is having all our Stores connect to the same repository.

 

Our branching strategy is having a different live branch for each site that will serve as the live theme.

 

For my specific use case, the majority of the code would be identical apart from the custom content being loaded on them via the Customiser (apart from a few small changes). So my solution was creating a Github workflow. We create the branch, complete the development work, then push to the Release branch. I setup a Github Workflow to exclude the settings_data.json and settings_schema.json files. Then on push to the release branch it runs a bunch of git commands (not the cleanest) to checkout each of the live branches for each site and push all the changes excluding the settings files to all of our Live themes at the same time. This doesn't overwrite the customiser settings.

 

Saying this, there are a couple of liquid conditions for unique code for Tracking and other small bits, but other than that this solution worked the best for me. Definitely improvements can be made though! 

View solution in original post

Replies 10 (10)
Jhenricks518
Shopify Partner
3 0 2

Also currently looking for a good workflow for this. 

as an agency, we want to have one GitHub repo with our “main” default theme and have custom configurations of that theme be used across many client builds. When we add new features to our main repo, it would be great if all the clients using that theme could get the updates. 

right now we’ve got it setup as a “template” repo and we start new repos per client. Hard to keep the client sites up to date as we implement new base features though. 

RossellaF
Shopify Partner
21 0 5

I am also looking for a good workflow for this.

 

I am thinking about having different branches the live themes on each store, connected to the same Github repository, so that the changes through the theme customizer are being kept track of.

 

The problem presents itself when wanting to work on a specific feature: which branch do I create the feature from (what is the real source of truth)?

Thinking it might be easier just to have a different repository for each store, even though it increases the time to manage any change to the code

MatthewG
Shopify Partner
6 1 7

This is an accepted solution.

@RossellaF The solution I ended up coming up with is having all our Stores connect to the same repository.

 

Our branching strategy is having a different live branch for each site that will serve as the live theme.

 

For my specific use case, the majority of the code would be identical apart from the custom content being loaded on them via the Customiser (apart from a few small changes). So my solution was creating a Github workflow. We create the branch, complete the development work, then push to the Release branch. I setup a Github Workflow to exclude the settings_data.json and settings_schema.json files. Then on push to the release branch it runs a bunch of git commands (not the cleanest) to checkout each of the live branches for each site and push all the changes excluding the settings files to all of our Live themes at the same time. This doesn't overwrite the customiser settings.

 

Saying this, there are a couple of liquid conditions for unique code for Tracking and other small bits, but other than that this solution worked the best for me. Definitely improvements can be made though! 

RossellaF
Shopify Partner
21 0 5

I see. So technically you don't have the Github integration set up, but you replicate that functionality with Github workflow instead. What happens if you need to create a new custom section? Do you add the code from the Shopify code editor directly?

MatthewG
Shopify Partner
6 1 7

We are using the Github integration for our live themes. Each live theme has it's own Github branch (live/store-name). We do the development work on another branch and push to a branch called "Release". The Github workflow triggers when something is pushed to the "Release" branch. From there, that workflow pushes all the code changes excluding the setting files to all the other "live/store-name" branches. As we have the Github Integration set up, it then updates all the code on Shopify (without overwriting the settings files!). 

 

Hope this helps.

RossellaF
Shopify Partner
21 0 5

That's really clever, thanks for sharing this with me! 

Wbarber
Shopify Partner
1 0 0

Hey Matthew,

That sounds like a great set up. Is there any chance you could share your Github workflows yml code? It would be a great help. Cheers


MatthewG
Shopify Partner
6 1 7

Hi,

 

See the public repo with the workflow yml code: https://github.com/matthewgelder/DawnTest

Note that this hasn't actually being used in production yet as it's experimental and can be heavily optimised I'm sure!

 

Thanks,

Matt

lpscleay
Excursionist
11 0 16

Struggling with this solution. I'm pretty novice with GitHub so please correct me if I'm wrong with any of this:

 

GitHub: main pushing theme files to several live branches using a workflow with paths-ignore excluding config and templates directories.

 

The issue (I think!), is that a directory (e.g. templates) specified in a GitHub workflow with paths-ignore references the directory of the changed files, not the destination directory. So a file changed outside of 'templates' will trigger the workflow, but one changed inside 'templates' will not. But when the workflow IS triggered, it updates all directories including 'templates'. So for me this workflow hasn't solved the issue of preventing the JSON settings files in the live branches from being overwritten.

 

I really hope I'm 100% wrong and have set something up incorrectly — please let me know if so!...

Danh11
Shopify Partner
60 2 19

You're right. I've gone down this road to try to make it work but ran into the same issue with this method that you described.