Build and deploy Theme with gitlab

Good morning everyone,

I am new to Shopify and I have a big struggle to build and deploy the theme we bought with gitlab.

Actually I am little bit confused, why there is only an github integration, but none for bitbucket or gitlab.

Let me describe the steps I did so far, and which error I receive in hope you guys can help me.

  1. I bought an theme from the theme store
  2. I installed Shopify CLI and used theme pull to download it
  3. After that I pushed this to my gitlab repository
  4. Then I installed the “Theme Access” app and created a token
  5. I created the gitlab-ci.yml [1] and pushed it into my git
  6. which led to the error message [2]

[1]

stages:
  - dev
  - prod

variables:
  NODE_VERSION: "20"
  DEVELOP_BRANCH: develop
  MAIN_BRANCH: main
  SHOPIFY_DEV_URL: "https://${SHOPIFY_DEV_STORE}.myshopify.com"
  SHOPIFY_PROD_URL: "https://${SHOPIFY_PROD_STORE}.myshopify.com"

# Template für gemeinsame Konfiguration
.shopify_deploy:
  image: node:${NODE_VERSION}
  tags:
    - docker
  before_script:
    - node --version
    - npm --version
    - npm install -g @shopify/cli@latest
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - node_modules/
  retry:
    max: 2
    when:
      - runner_system_failure
      - stuck_or_timeout_failure

dev:
  extends: .shopify_deploy
  stage: dev
  script:
    - shopify theme push
      --json
      --theme "$SHOPIFY_THEME_NAME"
      --store "$SHOPIFY_DEV_STORE"
      --password $SHOPIFY_DEV_ACCESS_TOKEN
      --path=.
      -d
  environment:
    name: development
    url: $SHOPIFY_DEV_URL
  only:
    - develop
  except:
    - tags

prod:
  extends: .shopify_deploy
  stage: prod
  script:
    - shopify theme push
      --json
      --theme "$SHOPIFY_THEME_NAME"
      --store "$SHOPIFY_PROD_STORE"
      --password $SHOPIFY_PROD_ACCESS_TOKEN
      --path=.
      -l
  environment:
    name: production
    url: $SHOPIFY_PROD_URL
  only:
    - tags
  when: manual  # Manuelle Bestätigung für Production

[2]

$ shopify theme push --json --theme "$SHOPIFY_THEME_NAME" --store "$SHOPIFY_DEV_STORE" --password ${SHOPIFY_DEV_ACCESS_TOKEN} --path=. -d
╭─error────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Unknown error connecting to your store dde-dev.myshopify.com: request to    │
│  https://theme-kit-access.shopifyapps.com/cli/admin/api/unstable/graphql.js  │
│  on failed, reason: connect ECONNREFUSED 185.146.173.20:443                  │
│                                                                              │
│  To investigate the issue, examine this stack trace:                         │
│    at fetchApiVersions                                                       │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:193687)            │
│    at processTicksAndRejections (node:internal/process/task_queues:95)       │
│    at async supportedApiVersions                                             │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:193670)            │
│    at async fetchLatestSupportedApiVersion                                   │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:193666)            │
│    at async adminRequestDoc                                                  │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:193644)            │
│    at async themeCreate                                                      │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:193751)            │
│    at create (usr/local/lib/node_modules/@shopify/cli/dist/index.js:194193)  │
│    at findOrCreate                                                           │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:194181)            │
│    at async push                                                             │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:199838)            │
│    at command                                                                │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:199975)            │                                                                   
╰───────────────────────────────────────────────────────────────────────────

I hope someone can help me with my problem, because the command I used in my gitlab-ci.yml works fine in my console, except it was interactive the first time.

Cheers,

Serdar

PS: I also had struggles to fill these kind of information inside of “theme deployment” or “shopify cli” for some reason its too much text…

You could save yourself a lot of time if you used GitHub instead and used Shopify’s GitHub integration.

Hi Luke,
thanks for the answer, but I cannot change the company infrastructure.
Actually there is no reason, that Shopify does not support other git solutions except github.
While working with SAP Commerce Cloud I was able to use any Git I want and I worked with all 3 I mentioned erlier.

And it doesn’t look like that Shopify is a small company anmymore which could be used as an explenation for a non-existent gitlab integration.