Use correct Shopify CLI command #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .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 |