How to deploy from 'main' branch of repository in Github to Current Shopify theme

Solved

How to deploy from 'main' branch of repository in Github to Current Shopify theme

daveh0
Shopify Partner
11 1 4

I'm just getting into editing theme files locally using Git and Shopify CLI and I'm trying to nail down my workflow. Everything seems to be working fine with the exception of the fact that I can't seem to figure out how to get code from the 'main' branch in GitHub to deploy to the Current theme in Shopify when I merge 'staging' into 'main' in Github.

 

Here's what I'm doing every time I have edits (assume 'main' branch and Current Theme are identical):

1. In the Theme Library in Shopify admin click 'Create Theme' and select 'Connect From GitHub'

2. Choose  to connect to 'main' branch - creates a duplicate of the Current theme

3. from 'main' branch, git checkout -b features/FEATURE_NAME - Creates a feature branch and switches over to it

4. git push --set-upstream origin feature/FEATURE_NAME - pushes feature branch files up to GitHub

5. make edits locally

6. add, commit and push changes up to GitHub

7. In GitHub, create Pull Request for Feature Branch ---> 'staging' branch

8. merge PR from #7

9. In Theme Library, preview Staging theme (this was created the same way as #1 upon initial setup) and verify changes

9. In GitHub, create Pull Request for 'staging ---> 'main' branch

10. . . .

 

It is my understanding that there is a way for the code that is merged into 'main' in #9 to also be deployed to the Current Theme, but I can't figure out how to connect them. The only way I know of connecting a branch with a theme is to create a new theme and choose 'Connect from GitHub' .

 

Right now, I'm having to use shopify theme push after syncing all my local files with GitHub which works, but I'd much rather be deploying from the 'main' branch of the repository for obvious reasons.

 

What am I missing? 

Accepted Solution (1)

daveh0
Shopify Partner
11 1 4

This is an accepted solution.

I figured it out....

 

After #2, you must publish the newly created theme. This creates the link to the GitHub repository. It should be noted that #1 and #2 (and the extra step just mentioned) only need to be done during initial setup.

View solution in original post

Reply 1 (1)

daveh0
Shopify Partner
11 1 4

This is an accepted solution.

I figured it out....

 

After #2, you must publish the newly created theme. This creates the link to the GitHub repository. It should be noted that #1 and #2 (and the extra step just mentioned) only need to be done during initial setup.