Test commit 4 #2
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
name: CI/CD Pipeline for Shopify | |
on: | |
push: | |
branches: | |
- feature/github-actions # Change 'feature/github-actions' to main | |
jobs: | |
lhci: | |
name: Lighthouse CI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 # Checkout code; no need for Node version specification here | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' # Explicitly set Node.js version to 20 | |
- name: Run Lighthouse CI | |
uses: shopify/lighthouse-ci-action@v1 | |
with: | |
store: ${{ secrets.SHOPIFY_STORE_URL }} | |
access_token: ${{ secrets.SHOPIFY_CLI_AUTH_TOKEN }} # Using CLI token if applicable | |
collection_handle: all | |
lhci_github_app_token: ${{ secrets.GITHUB_TOKEN }} # Using the default GitHub token | |
pull_theme: ${{ secrets.SHOPIFY_THEME_ID }} | |
theme-check: | |
name: Theme Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 # Checkout code; no need for Node version specification here | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' # Explicitly set Node.js version to 20 | |
- name: Run Theme Check | |
uses: shopify/theme-check-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} # Using the default GitHub token | |
deploy: | |
name: Deploy to Shopify Store | |
runs-on: ubuntu-latest | |
needs: [lhci, theme-check] # Ensure deployment runs after Lighthouse and Theme Check | |
steps: | |
- uses: actions/checkout@v3 # Checkout code; no need for Node version specification here | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' # Explicitly set Node.js version to 20 | |
- 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: Deploy Theme to Shopify | |
env: | |
SHOPIFY_STORE_URL: ${{ secrets.SHOPIFY_STORE_URL }} | |
SHOPIFY_THEME_ID: ${{ secrets.SHOPIFY_THEME_ID }} | |
run: shopify theme push --allow-live --themeid=${{ secrets.SHOPIFY_THEME_ID }} |