climaybe 3.4.1 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -231,7 +231,7 @@ Enabled via `climaybe init` prompt (`Enable preview + cleanup workflows?`; defau
|
|
|
231
231
|
|
|
232
232
|
| Workflow | Trigger | What it does |
|
|
233
233
|
|----------|---------|-------------|
|
|
234
|
-
| `pr-update.yml` | PR opened/synchronize/reopened (base: main, staging, develop, staging-*, live-*) | Shares draft theme, renames with `-PR<number>`, comments preview + customize URLs. **Multi-store +
|
|
234
|
+
| `pr-update.yml` | PR opened/synchronize/reopened (base: main, staging, develop, staging-*, live-*) | Shares draft theme, renames with `-PR<number>`, comments preview + customize URLs. **Multi-store + source branch (`pull_request.head.ref`) not** `staging-<alias>` **or** `live-<alias>`**:** publishes to **every** configured store (matrix) and posts **all** links in one PR comment. For `staging-<alias>` / `live-<alias>` source branches, only that store is used. **Path filter:** theme paths only (`assets/`, `blocks/`, `config/`, `layout/`, `locales/`, `sections/`, `snippets/`, `templates/`, `_scripts/`, `_styles/`, `shopify.theme.toml`, `stores/**`). |
|
|
235
235
|
| `pr-close.yml` | PR closed (same branch set) | Deletes this PR’s preview themes using the **same store matrix rule** as `pr-update`; PR comment shows **total** deleted count across stores. |
|
|
236
236
|
| `cleanup-orphan-preview-themes.yml` | Weekly (Mon 06:00 UTC) + `workflow_dispatch` | Per store: deletes themes ending with `-PR<n>` when PR `#n` is **not** open (merged/closed without cleanup). Uses `gh pr list` (limit 1000 open PRs). |
|
|
237
237
|
| `reusable-publish-pr-preview-store.yml` | workflow_call | Share + rename + upload comment fragment for **one** store (matrix leg in `pr-update`). |
|
|
@@ -382,7 +382,7 @@ Add the following secrets to your GitHub repository (or use **GitLab CI/CD varia
|
|
|
382
382
|
|
|
383
383
|
**Store URL:** During `climaybe init` (or `add-store`), store URL secret(s) are set from your configured store domain(s); theme tokens are optional prompts.
|
|
384
384
|
|
|
385
|
-
**Multi-store:** Per-store secrets `SHOPIFY_STORE_URL_<ALIAS>` and `SHOPIFY_THEME_ACCESS_TOKEN_<ALIAS>` — the URL is set from config; you must provide the theme token per store. `<ALIAS>` is uppercase with hyphens as underscores (e.g. `voldt-norway` → `SHOPIFY_STORE_URL_VOLDT_NORWAY`). **Preview:**
|
|
385
|
+
**Multi-store:** Per-store secrets `SHOPIFY_STORE_URL_<ALIAS>` and `SHOPIFY_THEME_ACCESS_TOKEN_<ALIAS>` — the URL is set from config; you must provide the theme token per store. `<ALIAS>` is uppercase with hyphens as underscores (e.g. `voldt-norway` → `SHOPIFY_STORE_URL_VOLDT_NORWAY`). **Preview:** if the PR source branch is **`staging-<alias>`** or **`live-<alias>`**, only that store is used. Otherwise, with **multiple** stores in `climaybe.config.json`, **pr-update** publishes the preview theme to **every** store (each must have secrets) and **pr-close** cleans that PR’s preview themes on **all** stores. For a **single** store in config, behavior matches the default-store case. Optional **cleanup-orphan-preview-themes** (weekly + manual) removes stale `-PR<n>` themes when PR `n` is no longer open.
|
|
386
386
|
|
|
387
387
|
## Directory Structure (Multi-store)
|
|
388
388
|
|
package/bin/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.4.
|
|
1
|
+
3.4.3
|
package/package.json
CHANGED
|
@@ -26,10 +26,11 @@ jobs:
|
|
|
26
26
|
- name: Checkout code
|
|
27
27
|
uses: actions/checkout@v4
|
|
28
28
|
|
|
29
|
-
- name: Resolve preview store targets from
|
|
29
|
+
- name: Resolve preview store targets from source branch
|
|
30
30
|
id: resolve
|
|
31
31
|
env:
|
|
32
32
|
BASE_REF: ${{ github.event.pull_request.base.ref }}
|
|
33
|
+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
|
33
34
|
run: |
|
|
34
35
|
node <<'NODE' >>"$GITHUB_OUTPUT"
|
|
35
36
|
const fs = require('fs');
|
|
@@ -37,9 +38,11 @@ jobs:
|
|
|
37
38
|
const stores = cfg?.stores || {};
|
|
38
39
|
const keys = Object.keys(stores);
|
|
39
40
|
const baseRef = process.env.BASE_REF || '';
|
|
41
|
+
const headRef = process.env.HEAD_REF || '';
|
|
42
|
+
const branchRef = headRef || baseRef;
|
|
40
43
|
const isMulti = keys.length > 1;
|
|
41
44
|
const isStagingLive =
|
|
42
|
-
|
|
45
|
+
branchRef && (/^staging-/.test(branchRef) || /^live-/.test(branchRef));
|
|
43
46
|
|
|
44
47
|
const aliasToSecret = (a) => String(a).toUpperCase().replace(/-/g, '_');
|
|
45
48
|
const normalizeDomain = (v) =>
|
|
@@ -52,7 +55,7 @@ jobs:
|
|
|
52
55
|
if (isMulti && !isStagingLive) {
|
|
53
56
|
targets = keys.map((alias) => ({ alias, alias_secret: aliasToSecret(alias) }));
|
|
54
57
|
} else if (isStagingLive) {
|
|
55
|
-
let a =
|
|
58
|
+
let a = branchRef.replace(/^staging-/, '').replace(/^live-/, '');
|
|
56
59
|
targets = [{ alias: a, alias_secret: aliasToSecret(a) }];
|
|
57
60
|
} else {
|
|
58
61
|
const defaultStoreNorm = normalizeDomain(cfg?.default_store);
|
|
@@ -51,10 +51,11 @@ jobs:
|
|
|
51
51
|
- name: Checkout code
|
|
52
52
|
uses: actions/checkout@v4
|
|
53
53
|
|
|
54
|
-
- name: Resolve preview store targets from
|
|
54
|
+
- name: Resolve preview store targets from source branch
|
|
55
55
|
id: resolve
|
|
56
56
|
env:
|
|
57
57
|
BASE_REF: ${{ github.event.pull_request.base.ref }}
|
|
58
|
+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
|
58
59
|
run: |
|
|
59
60
|
node <<'NODE' >>"$GITHUB_OUTPUT"
|
|
60
61
|
const fs = require('fs');
|
|
@@ -62,9 +63,11 @@ jobs:
|
|
|
62
63
|
const stores = cfg?.stores || {};
|
|
63
64
|
const keys = Object.keys(stores);
|
|
64
65
|
const baseRef = process.env.BASE_REF || '';
|
|
66
|
+
const headRef = process.env.HEAD_REF || '';
|
|
67
|
+
const branchRef = headRef || baseRef;
|
|
65
68
|
const isMulti = keys.length > 1;
|
|
66
69
|
const isStagingLive =
|
|
67
|
-
|
|
70
|
+
branchRef && (/^staging-/.test(branchRef) || /^live-/.test(branchRef));
|
|
68
71
|
|
|
69
72
|
const aliasToSecret = (a) => String(a).toUpperCase().replace(/-/g, '_');
|
|
70
73
|
const normalizeDomain = (v) =>
|
|
@@ -77,7 +80,7 @@ jobs:
|
|
|
77
80
|
if (isMulti && !isStagingLive) {
|
|
78
81
|
targets = keys.map((alias) => ({ alias, alias_secret: aliasToSecret(alias) }));
|
|
79
82
|
} else if (isStagingLive) {
|
|
80
|
-
let a =
|
|
83
|
+
let a = branchRef.replace(/^staging-/, '').replace(/^live-/, '');
|
|
81
84
|
targets = [{ alias: a, alias_secret: aliasToSecret(a) }];
|
|
82
85
|
} else {
|
|
83
86
|
const defaultStoreNorm = normalizeDomain(cfg?.default_store);
|
|
@@ -135,7 +138,7 @@ jobs:
|
|
|
135
138
|
echo "Shopify credentials OK for ${{ matrix.alias }}"
|
|
136
139
|
|
|
137
140
|
cleanup-themes:
|
|
138
|
-
needs: [extract-pr-number, validate-secrets-per-store]
|
|
141
|
+
needs: [validate-environment, extract-pr-number, validate-secrets-per-store]
|
|
139
142
|
strategy:
|
|
140
143
|
fail-fast: false
|
|
141
144
|
matrix:
|