Fix Gem installation issue and update Shopify CLI deployment #35
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: | | |
gem install --user-install shopify-cli | |
echo "export PATH=\$HOME/.local/share/gem/ruby/$(ls ~/.local/share/gem/ruby)/bin:\$PATH" >> $GITHUB_ENV | |
- name: Deploy to Shopify | |
env: | |
SHOPIFY_API_TOKEN: ${{ secrets.SHOPIFY_API_TOKEN }} | |
SHOPIFY_STORE: ${{ secrets.SHOPIFY_STORE }} | |
run: | | |
# Load the updated PATH | |
source $GITHUB_ENV | |
# Check Shopify CLI version | |
shopify version | |
# Authenticate using the API token | |
export SHOPIFY_CLI_AUTH_TOKEN=$SHOPIFY_API_TOKEN | |
# Push theme to Shopify store | |
shopify theme push --store "$SHOPIFY_STORE" --allow-live |