Skip to content

Use correct Shopify CLI command #38

Use correct Shopify CLI command

Use correct Shopify CLI command #38

Workflow file for this run

# .github/workflows/deploy-shopify-theme.yml
name: Deploy Shopify Theme
on:
push:
branches:
- main
- feature/* # Adjust branches as needed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby environment
run: |
sudo apt-get update
sudo apt-get install -y ruby-full build-essential
- name: Install Shopify CLI Locally
run: |
echo "Installing Shopify CLI..."
gem install --user-install shopify-cli
# Add Ruby Gems to PATH
echo "export PATH=$(ruby -e 'print Gem.user_dir')/bin:\$PATH" >> $GITHUB_ENV
- name: Verify and Debug PATH
run: |
# Directly export the PATH for this session
export PATH=$(ruby -e 'print Gem.user_dir')/bin:$PATH
echo "Updated PATH: $PATH"
ls $(ruby -e 'print Gem.user_dir')/bin # List contents to verify Shopify CLI installation
which shopify # Check if Shopify is in the PATH
shopify version
- name: Deploy to Shopify
env:
SHOPIFY_API_TOKEN: ${{ secrets.SHOPIFY_API_TOKEN }}
SHOPIFY_STORE_URL: ${{ secrets.SHOPIFY_STORE_URL }}
SHOPIFY_THEME_ID: ${{ secrets.SHOPIFY_THEME_ID }}
run: |
# Directly export the PATH for this session
export PATH=$(ruby -e 'print Gem.user_dir')/bin:$PATH
# Set the Shopify CLI authentication token environment variable
export SHOPIFY_CLI_AUTH_TOKEN=$SHOPIFY_API_TOKEN
# Push theme to Shopify store
shopify theme push --store="$SHOPIFY_STORE_URL" --theme="$SHOPIFY_THEME_ID" --allow-live