-
Notifications
You must be signed in to change notification settings - Fork 21
71 lines (59 loc) · 1.88 KB
/
Copy pathdeploy-main.yml
File metadata and controls
71 lines (59 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Deploy (main)
on:
push:
branches:
- main
# Prevent overlapping deploys if multiple merges happen quickly
concurrency:
group: deploy-live-theme
cancel-in-progress: true
permissions:
contents: read
jobs:
deploy:
name: Build + Deploy
runs-on: ubuntu-latest
# Extra safety: only run on main
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
# Use npm ci if you have a package-lock.json committed; otherwise npm install
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
npm ci
else
npm install
fi
- name: Install Shopify CLI
run: npm i -g @shopify/cli@latest
- name: Run build script
run: npm run build
# If your script already runs "shopify theme push", you don't need a separate push step.
- name: Upload theme to Shopify
run: |
shopify theme push \
--allow-live \
--json \
--theme ${{ secrets.SHOPIFY_THEME_ID }} \
--store ${{ secrets.SHOPIFY_STORE_URL }} \
--password ${{ secrets.SHOPIFY_API_PASSWORD }}
# If your npm script does NOT push, uncomment this step and remove push logic from npm script.
# - name: Push theme to LIVE
# env:
# SHOPIFY_CLI_THEME_TOKEN: ${{ secrets.SHOPIFY_CLI_THEME_TOKEN }}
# SHOPIFY_STORE: ${{ secrets.SHOPIFY_STORE }}
# SHOPIFY_THEME_ID: ${{ secrets.SHOPIFY_THEME_ID }}
# run: |
# set -euo pipefail
# yes | shopify theme push \
# --store "${SHOPIFY_STORE}" \
# --theme "${SHOPIFY_THEME_ID}" \
# --allow-live \
# --path .