Skip to content

Commit

Permalink
Test commit 27
Browse files Browse the repository at this point in the history
  • Loading branch information
phapsidesGT committed Sep 4, 2024
1 parent bb96074 commit 3b3b64b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 57 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ jobs:
- name: Install Shopify CLI
run: npm install -g @shopify/cli @shopify/theme

# - name: Authenticate Shopify CLI
# env:
# SHOPIFY_CLI_AUTH_TOKEN: ${{ secrets.SHOPIFY_CLI_AUTH_TOKEN }}
# run: echo $SHOPIFY_CLI_AUTH_TOKEN | shopify login --store ${{ secrets.SHOPIFY_STORE_URL }} --password-stdin
- name: Authenticate Shopify CLI
env:
SHOPIFY_CLI_AUTH_TOKEN: ${{ secrets.SHOPIFY_CLI_AUTH_TOKEN }}
SHOPIFY_PASSWORD: ${{ secrets.SHOPIFY_PASSWORD }}
run: echo $SHOPIFY_CLI_AUTH_TOKEN | shopify login

- name: Deploy Theme to Shopify
env:
Expand Down
106 changes: 53 additions & 53 deletions push-theme.sh
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
# .github/workflows/deploy-shopify-theme.yml
# # .github/workflows/deploy-shopify-theme.yml

name: Deploy Shopify Theme
# name: Deploy Shopify Theme

on:
push:
branches:
- main
- feature/github-actions # Replace with your branch name as needed
# on:
# push:
# branches:
# - main
# - feature/github-actions # Replace with your branch name as needed

jobs:
deploy:
runs-on: ubuntu-latest
# jobs:
# deploy:
# runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
# steps:
# - name: Checkout code
# uses: actions/checkout@v2

- name: Install Shopify CLI Dependencies
run: |
sudo apt-get update
sudo apt-get install -y ruby-full ruby-bundler ruby-dev build-essential
# - name: Install Shopify CLI Dependencies
# run: |
# sudo apt-get update
# sudo apt-get install -y ruby-full ruby-bundler ruby-dev build-essential

- name: Install Shopify CLI
run: |
echo "Installing Shopify CLI..."
gem install --user-install shopify-cli
# Dynamically add Ruby Gems to PATH
echo "PATH=$(ruby -e 'print Gem.user_dir')/bin:$PATH" >> $GITHUB_ENV
# - name: Install Shopify CLI
# run: |
# echo "Installing Shopify CLI..."
# gem install --user-install shopify-cli
# # Dynamically add Ruby Gems to PATH
# echo "PATH=$(ruby -e 'print Gem.user_dir')/bin:$PATH" >> $GITHUB_ENV

- name: Deploy to Shopify
env:
SHOPIFY_CLI_AUTH_TOKEN: ${{ secrets.SHOPIFY_CLI_AUTH_TOKEN }}
SHOPIFY_STORE: ${{ secrets.SHOPIFY_STORE }}
THEME_ID: ${{ secrets.THEME_ID }}
run: |
# Load the updated PATH
source $GITHUB_ENV
# - name: Deploy to Shopify
# env:
# SHOPIFY_CLI_AUTH_TOKEN: ${{ secrets.SHOPIFY_CLI_AUTH_TOKEN }}
# SHOPIFY_STORE: ${{ secrets.SHOPIFY_STORE }}
# THEME_ID: ${{ secrets.THEME_ID }}
# run: |
# # Load the updated PATH
# source $GITHUB_ENV

# Check Shopify CLI version
shopify version
# # Check Shopify CLI version
# shopify version

# Retry logic to push theme to Shopify store
attempt=0
max_attempts=5
delay=1
# # Retry logic to push theme to Shopify store
# attempt=0
# max_attempts=5
# delay=1

while [ $attempt -lt $max_attempts ]; do
echo "Pushing theme (Attempt: $((attempt + 1))/$max_attempts)..."
if shopify theme push --store="$SHOPIFY_STORE" --theme-id="$THEME_ID" --allow-live; then
echo "Theme pushed successfully."
break
else
echo "Error encountered. Retrying in $delay seconds..."
sleep $delay
attempt=$((attempt + 1))
delay=$((delay * 2)) # Exponential backoff
fi
done
# while [ $attempt -lt $max_attempts ]; do
# echo "Pushing theme (Attempt: $((attempt + 1))/$max_attempts)..."
# if shopify theme push --store="$SHOPIFY_STORE" --theme-id="$THEME_ID" --allow-live; then
# echo "Theme pushed successfully."
# break
# else
# echo "Error encountered. Retrying in $delay seconds..."
# sleep $delay
# attempt=$((attempt + 1))
# delay=$((delay * 2)) # Exponential backoff
# fi
# done

if [ $attempt -eq $max_attempts ]; then
echo "Failed to push theme after $max_attempts attempts."
exit 1
fi
# if [ $attempt -eq $max_attempts ]; then
# echo "Failed to push theme after $max_attempts attempts."
# exit 1
# fi

0 comments on commit 3b3b64b

Please sign in to comment.