--- title: Use Shopify CLI in a CI/CD pipeline description: Learn how to set up Shopify CLI for use in a CI/CD pipeline. source_url: html: https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd md: https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd.md --- ExpandOn this page * [What you'll learn](https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd#what-youll-learn) * [Requirements](https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd#requirements) * [Step 1: Get a Theme Access password for the store](https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd#step-1-get-a-theme-access-password-for-the-store) * [Step 2: Integrate Shopify CLI into your pipeline](https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd#step-2-integrate-shopify-cli-into-your-pipeline) # Use Shopify CLI in a CI/CD pipeline If you have a theme that you want to work with programmatically, then you can integrate Shopify CLI into your CI/CD pipeline to perform actions like pushing, pulling, and publishing a theme. *** ## What you'll learn In this tutorial, you'll learn how to set up your CI/CD pipeline to work with themes programmatically. To do so, you'll gather the credentials necessary to run the CLI commands, and then add a step to your CI/CD pipeline that installs Shopify CLI and runs CLI commands. *** ## Requirements * [Shopify CLI 3.20 or higher](https://shopify.dev/docs/storefronts/themes/tools/cli/cli-2/commands) Tip [Learn how to check your Shopify CLI version](https://shopify.dev/docs/storefronts/themes/tools/cli/cli-2/commands#version). *** ## Step 1: Get a Theme Access password for the store For each store that you want to interact with programmatically using Shopify CLI, you need to get a Theme Access password. These are generated using the [Theme Access](https://apps.shopify.com/theme-access) app. To learn about the requirements for installing and using the Theme Access app, and instructions on how to generate a new password, refer to [Manage theme access](https://shopify.dev/docs/storefronts/themes/tools/theme-access). *** ## Step 2: Integrate Shopify CLI into your pipeline After you get a Theme Access password for the store, you can integrate Shopify CLI into your continuous deployment pipeline using your CI/CD provider. The CD pipeline step should install Shopify CLI and all of its [dependencies](https://shopify.dev/docs/api/shopify-cli#requirements). To run Shopify CLI theme commands programmatically using your CD pipeline step, include the following: * Environment variables (or equivalent flags): | Name | Required? | Value | | - | - | - | | `SHOPIFY_CLI_THEME_TOKEN` | Yes | The [Theme Access password](#step-1-get-a-theme-access-password-for-the-store) that you generated or were given by a merchant | | `SHOPIFY_FLAG_STORE` | Yes | The store that you want to interact with | | `SHOPIFY_FLAG_FORCE` | No | Pass this variable with a value of `1` to turn off interactive prompts. You may want to use this variable if your Shopify CLI pipeline step is timing out. | Where possible, you should protect the Theme Access password by masking it or storing it as a secret. * A step that sets up Node.js. * A step that installs Shopify CLI globally. * A step that runs the CLI command that you want to execute. ### Example (Git​Hub Actions) Below is an example of a step that you might add to your GitHub Actions workflow. It pushes a theme to a Shopify store when code is pushed to the `main` branch. ## .github/workflows/deploy-theme.yml ```yml name: Theme deploy on: [push] jobs: deploy: name: Deploy runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - name: Install Shopify CLI run: npm install -g @shopify/cli - name: Upload theme run: | shopify theme push \ --json \ --theme your-theme-name-or-id \ --store ${{ secrets.SHOPIFY_FLAG_STORE }} \ --password ${{ secrets.SHOPIFY_CLI_THEME_TOKEN }} ``` *** * [What you'll learn](https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd#what-youll-learn) * [Requirements](https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd#requirements) * [Step 1: Get a Theme Access password for the store](https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd#step-1-get-a-theme-access-password-for-the-store) * [Step 2: Integrate Shopify CLI into your pipeline](https://shopify.dev/docs/storefronts/themes/tools/cli/ci-cd#step-2-integrate-shopify-cli-into-your-pipeline)