@codigodoleo/wp-kit 5.0.2 → 5.1.0
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/lib/commands/init.js +87 -78
- package/lib/config/versions.js +45 -45
- package/lib/core/infer-ci-capabilities.js +39 -26
- package/lib/prompts/index.js +113 -92
- package/modules/blank-theme/index.js +23 -34
- package/modules/blank-theme/prompts.js +9 -25
- package/modules/blank-theme/templates/.lando.yml.hbs +5 -8
- package/modules/blank-theme/templates/package.json.hbs +1 -1
- package/modules/deploy/index.js +51 -61
- package/modules/deploy/prompts.js +36 -12
- package/modules/deploy/templates/.github/workflows/ci.yml.hbs +356 -63
- package/modules/deploy/templates/.gitlab/ci/lint-blank-theme.yml.hbs +4 -4
- package/modules/deploy/templates/.gitlab/ci/lint-mu-plugin.yml.hbs +3 -2
- package/modules/deploy/templates/.gitlab/ci/lint-plugin.yml.hbs +3 -2
- package/modules/deploy/templates/.gitlab/ci/lint-sage.yml.hbs +17 -14
- package/modules/git/.lintstagedrc.json +2 -5
- package/modules/lint/.oxlintrc.json +19 -0
- package/modules/lint/.prettierignore +16 -1
- package/modules/lint/index.js +32 -40
- package/modules/lint/templates/mago.toml.hbs +83 -0
- package/modules/lint/templates/package.json.hbs +6 -10
- package/modules/lint/templates/workspace.json.hbs +2 -36
- package/modules/mu-plugin/index.js +39 -51
- package/modules/mu-plugin/prompts.js +10 -28
- package/modules/mu-plugin/templates/.lando.yml.hbs +8 -10
- package/modules/mu-plugin/templates/acorn/composer.json.hbs +6 -5
- package/modules/mu-plugin/templates/composer.json.hbs +4 -2
- package/modules/php/templates/.lando.yml.hbs +13 -8
- package/modules/php/templates/composer.json.hbs +15 -7
- package/modules/php/templates/workspace.json.hbs +22 -19
- package/modules/plugin/index.js +10 -18
- package/modules/plugin/prompts.js +5 -19
- package/modules/plugin/templates/.lando.yml.hbs +8 -10
- package/modules/plugin/templates/composer.json.hbs +4 -2
- package/modules/sage/index.js +78 -88
- package/modules/sage/prompts.js +10 -24
- package/modules/sage/templates/.lando.yml.hbs +17 -7
- package/modules/sage/templates/theme/composer.json.hbs +36 -23
- package/modules/sage/templates/theme/package.json.hbs +24 -13
- package/modules/test/templates/composer.json.hbs +1 -1
- package/package.json +30 -35
- package/templates/.devcontainer/devcontainer.json.hbs +2 -2
- package/templates/.gitignore.hbs +1 -0
- package/templates/auth.json.hbs +8 -0
- package/templates/composer.json.hbs +13 -5
- package/templates/package.json.hbs +2 -4
- package/templates/workspace.json.hbs +3 -4
- package/wp-config.php +5 -0
- package/modules/blank-theme/lint/eslint.config.mjs +0 -30
- package/modules/blank-theme/lint/pint.json +0 -11
- package/modules/deploy/.github/workflows/deploy-docker.yml +0 -104
- package/modules/deploy/.github/workflows/deploy-ssh.yml +0 -128
- package/modules/deploy/.github/workflows/release.yml +0 -57
- package/modules/mu-plugin/lint/eslint.config.mjs +0 -30
- package/modules/mu-plugin/lint/pint.json +0 -11
- package/modules/plugin/lint/eslint.config.mjs +0 -30
- package/modules/plugin/lint/pint.json +0 -11
- package/modules/sage/lint/eslint.config.mjs +0 -30
- package/modules/sage/lint/pint.json +0 -11
|
@@ -1,77 +1,370 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
# CI — {{projectName}}
|
|
2
|
+
#
|
|
3
|
+
# Quality gate and deploy pipeline using hekivo/gha-workflows shared actions.
|
|
4
|
+
# Secrets are resolved via 1Password Connect (Connect server at vars.OP_CONNECT_HOST,
|
|
5
|
+
# authenticated with secrets.OP_CONNECT_TOKEN). Update the op:// paths below to
|
|
6
|
+
# match your project's vault items before first run.
|
|
7
|
+
|
|
8
|
+
name: CI
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [main, staging]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [main, staging]
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
inputs:
|
|
17
|
+
deploy:
|
|
18
|
+
description: "Run deploy after build"
|
|
19
|
+
required: false
|
|
20
|
+
type: boolean
|
|
21
|
+
default: false
|
|
22
|
+
{{#if ci.deploy.ssh}}
|
|
23
|
+
deploy-environment:
|
|
24
|
+
description: "Target environment when deploy=true"
|
|
25
|
+
required: false
|
|
26
|
+
type: choice
|
|
27
|
+
options:
|
|
28
|
+
- staging
|
|
29
|
+
- production
|
|
30
|
+
default: staging
|
|
31
|
+
{{/if}}
|
|
32
|
+
|
|
33
|
+
permissions:
|
|
34
|
+
contents: read
|
|
35
|
+
{{#if ci.deploy.docker}}
|
|
36
|
+
packages: write
|
|
16
37
|
{{/if}}
|
|
17
38
|
|
|
39
|
+
concurrency:
|
|
40
|
+
group: ci-${{'{{'}} github.ref {{'}}'}}
|
|
41
|
+
cancel-in-progress: true
|
|
42
|
+
|
|
43
|
+
env:
|
|
44
|
+
PHP_VERSION: "{{phpVersion}}"
|
|
45
|
+
NODE_VERSION: "{{nodeVersion}}"
|
|
18
46
|
{{#if ci.build.sage}}
|
|
19
|
-
|
|
20
|
-
actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
|
|
21
|
-
env.NODE_VERSION
|
|
22
|
-
{{'}}'}}
|
|
23
|
-
- name: Build theme run: | THEME="{{ci.theme.paths.themeRoot}}" if [ -d "$THEME" ]; then cd
|
|
24
|
-
"$THEME" if [ -f package.json ]; then npm ci; fi if [ -f yarn.lock ]; then yarn install
|
|
25
|
-
--frozen-lockfile; fi if [ -f package.json ]; then npm run build || yarn build; fi else echo "Tema
|
|
26
|
-
não encontrado em $THEME — pulando build do tema" fi
|
|
47
|
+
THEME_PATH: {{ci.theme.paths.themeRoot}}
|
|
27
48
|
{{/if}}
|
|
49
|
+
# Disable husky in CI — no human commits, and semantic-release's auto-commit
|
|
50
|
+
# (chore(release): vX.Y.Z [skip ci]) would trip the commitlint hook.
|
|
51
|
+
# https://typioca.github.io/husky/how-to.html#ci-server-and-docker
|
|
52
|
+
HUSKY: "0"
|
|
28
53
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
54
|
+
jobs:
|
|
55
|
+
# ── Quality Gate ────────────────────────────────────────────────────────────
|
|
56
|
+
quality:
|
|
57
|
+
uses: hekivo/gha-workflows/.github/workflows/quality.yml@v1
|
|
58
|
+
with:
|
|
59
|
+
php-version: ${{'{{'}} env.PHP_VERSION {{'}}'}}
|
|
60
|
+
node-version: ${{'{{'}} env.NODE_VERSION {{'}}'}}
|
|
61
|
+
{{#if ci.build.sage}}
|
|
62
|
+
theme-path: ${{'{{'}} env.THEME_PATH {{'}}'}}
|
|
63
|
+
{{/if}}
|
|
64
|
+
mago-lint-continue-on-error: false
|
|
65
|
+
secrets:
|
|
66
|
+
OP_CONNECT_TOKEN: ${{'{{'}} secrets.OP_CONNECT_TOKEN {{'}}'}}
|
|
67
|
+
{{#if enable_acf_pro}}
|
|
68
|
+
ACF_CONNECT_USERNAME: ${{'{{'}} secrets.ACF_CONNECT_USERNAME {{'}}'}}
|
|
69
|
+
ACF_CONNECT_PASSWORD: ${{'{{'}} secrets.ACF_CONNECT_PASSWORD {{'}}'}}
|
|
70
|
+
{{/if}}
|
|
71
|
+
|
|
72
|
+
{{#if ci.deploy.docker}}
|
|
73
|
+
# ── Docker Build ─────────────────────────────────────────────────────────────
|
|
74
|
+
docker-build:
|
|
75
|
+
needs: quality
|
|
76
|
+
uses: hekivo/gha-workflows/.github/workflows/docker-build.yml@v1
|
|
77
|
+
with:
|
|
78
|
+
image-name: ${{'{{'}} github.repository {{'}}'}}
|
|
79
|
+
platforms: linux/amd64
|
|
80
|
+
permissions:
|
|
81
|
+
packages: write
|
|
82
|
+
contents: read
|
|
83
|
+
|
|
84
|
+
# ── Docker Publish ────────────────────────────────────────────────────────────
|
|
85
|
+
docker-publish:
|
|
86
|
+
needs: docker-build
|
|
87
|
+
if: |
|
|
88
|
+
github.event_name == 'push' ||
|
|
89
|
+
(github.event_name == 'workflow_dispatch' && inputs.deploy == true)
|
|
90
|
+
uses: hekivo/gha-workflows/.github/workflows/docker-publish.yml@v1
|
|
91
|
+
with:
|
|
92
|
+
source-image: ${{'{{'}} needs.docker-build.outputs.image-ref {{'}}'}}
|
|
93
|
+
registry-type: {{docker_registry}}
|
|
94
|
+
image-name: ${{'{{'}} github.repository {{'}}'}}
|
|
95
|
+
image-tag: ${{'{{'}} github.ref_name {{'}}'}}
|
|
96
|
+
{{#if ci.docker.registryEcr}}
|
|
97
|
+
aws-region: us-east-1 # TODO: update region
|
|
98
|
+
ecr-registry: "" # TODO: 123456789012.dkr.ecr.us-east-1.amazonaws.com
|
|
99
|
+
{{/if}}
|
|
100
|
+
{{#if ci.docker.registryDockerHub}}
|
|
101
|
+
dockerhub-username: "" # TODO: set your Docker Hub username
|
|
102
|
+
{{/if}}
|
|
103
|
+
{{#if ci.docker.registryGitlab}}
|
|
104
|
+
gitlab-registry: registry.gitlab.com # TODO: update if self-hosted
|
|
105
|
+
{{/if}}
|
|
106
|
+
secrets:
|
|
107
|
+
{{#if ci.docker.registryEcr}}
|
|
108
|
+
AWS_ROLE_ARN: ${{'{{'}} secrets.AWS_ROLE_ARN {{'}}'}}
|
|
34
109
|
{{/if}}
|
|
110
|
+
{{#if ci.docker.registryDockerHub}}
|
|
111
|
+
DOCKERHUB_TOKEN: ${{'{{'}} secrets.DOCKERHUB_TOKEN {{'}}'}}
|
|
112
|
+
{{/if}}
|
|
113
|
+
{{#if ci.docker.registryGitlab}}
|
|
114
|
+
GITLAB_REGISTRY_TOKEN: ${{'{{'}} secrets.GITLAB_REGISTRY_TOKEN {{'}}'}}
|
|
115
|
+
{{/if}}
|
|
116
|
+
permissions:
|
|
117
|
+
packages: read
|
|
118
|
+
contents: read
|
|
119
|
+
id-token: write
|
|
120
|
+
{{/if}}
|
|
121
|
+
|
|
122
|
+
{{#if ci.deploy.ssh}}
|
|
123
|
+
# ── Deploy Staging ───────────────────────────────────────────────────────────
|
|
124
|
+
deploy-staging:
|
|
125
|
+
needs: quality
|
|
126
|
+
runs-on: ubuntu-latest
|
|
127
|
+
environment: staging
|
|
128
|
+
if: |
|
|
129
|
+
(github.event_name == 'workflow_dispatch' && inputs.deploy == true && inputs['deploy-environment'] == 'staging') ||
|
|
130
|
+
(github.event_name == 'push' && github.ref == 'refs/heads/staging')
|
|
35
131
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
132
|
+
steps:
|
|
133
|
+
- name: Checkout
|
|
134
|
+
uses: actions/checkout@v4
|
|
135
|
+
|
|
136
|
+
- name: Load secrets from 1Password
|
|
137
|
+
uses: 1password/load-secrets-action@v2
|
|
138
|
+
with:
|
|
139
|
+
export-env: true
|
|
140
|
+
env:
|
|
141
|
+
OP_CONNECT_HOST: ${{'{{'}} vars.OP_CONNECT_HOST {{'}}'}}
|
|
142
|
+
OP_CONNECT_TOKEN: ${{'{{'}} secrets.OP_CONNECT_TOKEN {{'}}'}}
|
|
143
|
+
{{#if enable_acf_pro}}
|
|
144
|
+
# ACF Pro Composer auth — item shared across all projects in Hekivo-Internal
|
|
145
|
+
ACF_CONNECT_USERNAME: op://Hekivo-Internal/{{projectName}}-acf-connect/username
|
|
146
|
+
ACF_CONNECT_PASSWORD: op://Hekivo-Internal/{{projectName}}-acf-connect/password
|
|
147
|
+
{{/if}}
|
|
148
|
+
# SSH transport credentials — update vault/item paths for this project
|
|
149
|
+
SSH_HOST: op://Client-{{projectName}}/ssh-staging/hostname
|
|
150
|
+
SSH_USER: op://Client-{{projectName}}/ssh-staging/username
|
|
151
|
+
SSH_REMOTE_PATH: op://Client-{{projectName}}/ssh-staging/remote-path
|
|
152
|
+
SSH_PRIVATE_KEY: op://Client-{{projectName}}/staging-server-ssh-key/private_key?ssh-format=openssh
|
|
153
|
+
{{#if ci.ssh.useCloudflare}}
|
|
154
|
+
# Cloudflare Access Service Token for SSH tunnel (staging)
|
|
155
|
+
TUNNEL_SERVICE_TOKEN_ID: op://Hekivo-Internal/{{projectName}}-cf-access-gha-staging/client-id
|
|
156
|
+
TUNNEL_SERVICE_TOKEN_SECRET: op://Hekivo-Internal/{{projectName}}-cf-access-gha-staging/client-secret
|
|
41
157
|
{{/if}}
|
|
158
|
+
# .env composition (3 layers: template + salts + DB)
|
|
159
|
+
ENV_TEMPLATE: op://Client-{{projectName}}/staging-env-file/notesPlain
|
|
160
|
+
WP_SALTS_BLOCK: op://Client-{{projectName}}/wp-salts/notesPlain
|
|
161
|
+
WORDPRESS_DB_NAME: op://Client-{{projectName}}/staging-wp-database/database
|
|
162
|
+
WORDPRESS_DB_USER: op://Client-{{projectName}}/staging-wp-database/username
|
|
163
|
+
WORDPRESS_DB_PASSWORD: op://Client-{{projectName}}/staging-wp-database/password
|
|
164
|
+
WORDPRESS_DB_HOST: op://Client-{{projectName}}/staging-wp-database/hostname
|
|
165
|
+
WORDPRESS_DB_PORT: op://Client-{{projectName}}/staging-wp-database/port
|
|
166
|
+
# Cloudflare cache purge
|
|
167
|
+
CLOUDFLARE_PURGE_ZONE_ID: op://Hekivo-Internal/{{projectName}}-cloudflare-api/zone id
|
|
168
|
+
CLOUDFLARE_PURGE_TOKEN: op://Hekivo-Internal/{{projectName}}-cloudflare-api/credential
|
|
42
169
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
170
|
+
- name: Setup WordPress (production deps)
|
|
171
|
+
uses: hekivo/gha-workflows/actions/setup-wordpress@v1
|
|
172
|
+
with:
|
|
173
|
+
php-version: ${{'{{'}} env.PHP_VERSION {{'}}'}}
|
|
174
|
+
no-dev: "true"
|
|
175
|
+
{{#if ci.build.sage}}
|
|
176
|
+
working-dir: ${{'{{'}} env.THEME_PATH {{'}}'}}
|
|
177
|
+
{{/if}}
|
|
178
|
+
{{#if enable_acf_pro}}
|
|
179
|
+
acf-username: ${{'{{'}} env.ACF_CONNECT_USERNAME {{'}}'}}
|
|
180
|
+
acf-password: ${{'{{'}} env.ACF_CONNECT_PASSWORD {{'}}'}}
|
|
48
181
|
{{/if}}
|
|
49
182
|
|
|
50
|
-
{{#if ci.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
183
|
+
{{#if ci.build.sage}}
|
|
184
|
+
- name: Setup Node.js + theme
|
|
185
|
+
uses: hekivo/gha-workflows/actions/setup-node-theme@v1
|
|
186
|
+
with:
|
|
187
|
+
node-version: ${{'{{'}} env.NODE_VERSION {{'}}'}}
|
|
188
|
+
install-root: "false"
|
|
189
|
+
theme-path: ${{'{{'}} env.THEME_PATH {{'}}'}}
|
|
190
|
+
|
|
191
|
+
- name: Build theme assets
|
|
192
|
+
run: npm run build --prefix "${{'{{'}} env.THEME_PATH {{'}}'}}"
|
|
193
|
+
|
|
55
194
|
{{/if}}
|
|
195
|
+
- name: Compose .env
|
|
196
|
+
uses: hekivo/gha-workflows/actions/compose-dotenv@v1
|
|
197
|
+
with:
|
|
198
|
+
env-template: ${{'{{'}} env.ENV_TEMPLATE {{'}}'}}
|
|
199
|
+
wp-salts: ${{'{{'}} env.WP_SALTS_BLOCK {{'}}'}}
|
|
200
|
+
db-name: ${{'{{'}} env.WORDPRESS_DB_NAME {{'}}'}}
|
|
201
|
+
db-user: ${{'{{'}} env.WORDPRESS_DB_USER {{'}}'}}
|
|
202
|
+
db-password: ${{'{{'}} env.WORDPRESS_DB_PASSWORD {{'}}'}}
|
|
203
|
+
db-host: ${{'{{'}} env.WORDPRESS_DB_HOST {{'}}'}}
|
|
204
|
+
db-port: ${{'{{'}} env.WORDPRESS_DB_PORT {{'}}'}}
|
|
56
205
|
|
|
57
|
-
|
|
58
|
-
name: Setup
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
206
|
+
{{#if ci.ssh.useCloudflare}}
|
|
207
|
+
- name: Setup SSH via Cloudflare Tunnel
|
|
208
|
+
uses: hekivo/gha-workflows/actions/setup-cloudflare-ssh@v1
|
|
209
|
+
with:
|
|
210
|
+
ssh-host: ${{'{{'}} env.SSH_HOST {{'}}'}}
|
|
211
|
+
ssh-user: ${{'{{'}} env.SSH_USER {{'}}'}}
|
|
212
|
+
ssh-private-key: ${{'{{'}} env.SSH_PRIVATE_KEY {{'}}'}}
|
|
213
|
+
tunnel-token-id: ${{'{{'}} env.TUNNEL_SERVICE_TOKEN_ID {{'}}'}}
|
|
214
|
+
tunnel-token-secret: ${{'{{'}} env.TUNNEL_SERVICE_TOKEN_SECRET {{'}}'}}
|
|
215
|
+
{{else}}
|
|
216
|
+
- name: Configure SSH agent
|
|
217
|
+
uses: webfactory/ssh-agent@v0.9.0
|
|
218
|
+
with:
|
|
219
|
+
ssh-private-key: ${{'{{'}} env.SSH_PRIVATE_KEY {{'}}'}}
|
|
62
220
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
{{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
221
|
+
- name: Add known hosts
|
|
222
|
+
run: |
|
|
223
|
+
mkdir -p ~/.ssh
|
|
224
|
+
ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
|
|
225
|
+
chmod 600 ~/.ssh/known_hosts
|
|
226
|
+
{{/if}}
|
|
227
|
+
|
|
228
|
+
- name: Deploy via rsync
|
|
229
|
+
uses: hekivo/gha-workflows/actions/deploy-rsync@v1
|
|
230
|
+
with:
|
|
231
|
+
ssh-target: ${{'{{'}} env.SSH_HOST {{'}}'}}
|
|
232
|
+
remote-root: ${{'{{'}} env.SSH_REMOTE_PATH {{'}}'}}
|
|
233
|
+
{{#if ci.build.sage}}
|
|
234
|
+
theme-slug: {{projectName}}
|
|
235
|
+
{{/if}}
|
|
236
|
+
|
|
237
|
+
- name: WordPress post-deploy
|
|
238
|
+
uses: hekivo/gha-workflows/actions/wp-post-deploy@v1
|
|
239
|
+
with:
|
|
240
|
+
ssh-target: ${{'{{'}} env.SSH_HOST {{'}}'}}
|
|
241
|
+
remote-root: ${{'{{'}} env.SSH_REMOTE_PATH {{'}}'}}
|
|
242
|
+
{{#if enable_acf_pro}}
|
|
243
|
+
plugin-slug: advanced-custom-fields-pro
|
|
244
|
+
{{/if}}
|
|
245
|
+
{{#if ci.build.sage}}
|
|
246
|
+
theme-slug: {{projectName}}
|
|
247
|
+
{{/if}}
|
|
248
|
+
|
|
249
|
+
- name: Purge Cloudflare cache
|
|
250
|
+
uses: hekivo/gha-workflows/actions/cloudflare-purge@v1
|
|
251
|
+
with:
|
|
252
|
+
zone-id: ${{'{{'}} env.CLOUDFLARE_PURGE_ZONE_ID {{'}}'}}
|
|
253
|
+
api-token: ${{'{{'}} env.CLOUDFLARE_PURGE_TOKEN {{'}}'}}
|
|
254
|
+
|
|
255
|
+
# ── Deploy Production ─────────────────────────────────────────────────────────
|
|
256
|
+
deploy-production:
|
|
257
|
+
needs: quality
|
|
258
|
+
runs-on: ubuntu-latest
|
|
259
|
+
environment: production
|
|
260
|
+
if: |
|
|
261
|
+
(github.event_name == 'workflow_dispatch' && inputs.deploy == true && inputs['deploy-environment'] == 'production') ||
|
|
262
|
+
(github.event_name == 'push' && github.ref == 'refs/heads/main')
|
|
263
|
+
|
|
264
|
+
steps:
|
|
265
|
+
- name: Checkout
|
|
266
|
+
uses: actions/checkout@v4
|
|
267
|
+
|
|
268
|
+
- name: Load secrets from 1Password
|
|
269
|
+
uses: 1password/load-secrets-action@v2
|
|
270
|
+
with:
|
|
271
|
+
export-env: true
|
|
272
|
+
env:
|
|
273
|
+
OP_CONNECT_HOST: ${{'{{'}} vars.OP_CONNECT_HOST {{'}}'}}
|
|
274
|
+
OP_CONNECT_TOKEN: ${{'{{'}} secrets.OP_CONNECT_TOKEN {{'}}'}}
|
|
275
|
+
{{#if enable_acf_pro}}
|
|
276
|
+
ACF_CONNECT_USERNAME: op://Hekivo-Internal/{{projectName}}-acf-connect/username
|
|
277
|
+
ACF_CONNECT_PASSWORD: op://Hekivo-Internal/{{projectName}}-acf-connect/password
|
|
278
|
+
{{/if}}
|
|
279
|
+
SSH_HOST: op://Client-{{projectName}}/ssh-production/hostname
|
|
280
|
+
SSH_USER: op://Client-{{projectName}}/ssh-production/username
|
|
281
|
+
SSH_PORT: op://Client-{{projectName}}/ssh-production/port
|
|
282
|
+
SSH_REMOTE_PATH: op://Client-{{projectName}}/ssh-production/remote-path
|
|
283
|
+
SSH_PRIVATE_KEY: op://Client-{{projectName}}/production-server-ssh-key/private_key?ssh-format=openssh
|
|
284
|
+
ENV_TEMPLATE: op://Client-{{projectName}}/production-env-file/notesPlain
|
|
285
|
+
WP_SALTS_BLOCK: op://Client-{{projectName}}/wp-salts/notesPlain
|
|
286
|
+
WORDPRESS_DB_NAME: op://Client-{{projectName}}/production-wp-database/database
|
|
287
|
+
WORDPRESS_DB_USER: op://Client-{{projectName}}/production-wp-database/username
|
|
288
|
+
WORDPRESS_DB_PASSWORD: op://Client-{{projectName}}/production-wp-database/password
|
|
289
|
+
WORDPRESS_DB_HOST: op://Client-{{projectName}}/production-wp-database/hostname
|
|
290
|
+
WORDPRESS_DB_PORT: op://Client-{{projectName}}/production-wp-database/port
|
|
291
|
+
CLOUDFLARE_PURGE_ZONE_ID: op://Hekivo-Internal/{{projectName}}-cloudflare-api/zone id
|
|
292
|
+
CLOUDFLARE_PURGE_TOKEN: op://Hekivo-Internal/{{projectName}}-cloudflare-api/credential
|
|
293
|
+
|
|
294
|
+
- name: Setup WordPress (production deps)
|
|
295
|
+
uses: hekivo/gha-workflows/actions/setup-wordpress@v1
|
|
296
|
+
with:
|
|
297
|
+
php-version: ${{'{{'}} env.PHP_VERSION {{'}}'}}
|
|
298
|
+
no-dev: "true"
|
|
299
|
+
{{#if ci.build.sage}}
|
|
300
|
+
working-dir: ${{'{{'}} env.THEME_PATH {{'}}'}}
|
|
301
|
+
{{/if}}
|
|
302
|
+
{{#if enable_acf_pro}}
|
|
303
|
+
acf-username: ${{'{{'}} env.ACF_CONNECT_USERNAME {{'}}'}}
|
|
304
|
+
acf-password: ${{'{{'}} env.ACF_CONNECT_PASSWORD {{'}}'}}
|
|
305
|
+
{{/if}}
|
|
306
|
+
|
|
307
|
+
{{#if ci.build.sage}}
|
|
308
|
+
- name: Setup Node.js + theme
|
|
309
|
+
uses: hekivo/gha-workflows/actions/setup-node-theme@v1
|
|
310
|
+
with:
|
|
311
|
+
node-version: ${{'{{'}} env.NODE_VERSION {{'}}'}}
|
|
312
|
+
install-root: "false"
|
|
313
|
+
theme-path: ${{'{{'}} env.THEME_PATH {{'}}'}}
|
|
314
|
+
|
|
315
|
+
- name: Build theme assets
|
|
316
|
+
run: npm run build --prefix "${{'{{'}} env.THEME_PATH {{'}}'}}"
|
|
317
|
+
|
|
318
|
+
{{/if}}
|
|
319
|
+
- name: Compose .env
|
|
320
|
+
uses: hekivo/gha-workflows/actions/compose-dotenv@v1
|
|
321
|
+
with:
|
|
322
|
+
env-template: ${{'{{'}} env.ENV_TEMPLATE {{'}}'}}
|
|
323
|
+
wp-salts: ${{'{{'}} env.WP_SALTS_BLOCK {{'}}'}}
|
|
324
|
+
db-name: ${{'{{'}} env.WORDPRESS_DB_NAME {{'}}'}}
|
|
325
|
+
db-user: ${{'{{'}} env.WORDPRESS_DB_USER {{'}}'}}
|
|
326
|
+
db-password: ${{'{{'}} env.WORDPRESS_DB_PASSWORD {{'}}'}}
|
|
327
|
+
db-host: ${{'{{'}} env.WORDPRESS_DB_HOST {{'}}'}}
|
|
328
|
+
db-port: ${{'{{'}} env.WORDPRESS_DB_PORT {{'}}'}}
|
|
329
|
+
|
|
330
|
+
- name: Configure SSH agent
|
|
331
|
+
uses: webfactory/ssh-agent@v0.9.0
|
|
332
|
+
with:
|
|
333
|
+
ssh-private-key: ${{'{{'}} env.SSH_PRIVATE_KEY {{'}}'}}
|
|
334
|
+
|
|
335
|
+
- name: Add known hosts
|
|
336
|
+
run: |
|
|
337
|
+
PORT="${SSH_PORT:-22}"
|
|
338
|
+
mkdir -p ~/.ssh
|
|
339
|
+
ssh-keyscan -p "$PORT" -H "$SSH_HOST" >> ~/.ssh/known_hosts
|
|
340
|
+
chmod 600 ~/.ssh/known_hosts
|
|
341
|
+
|
|
342
|
+
- name: Deploy via rsync
|
|
343
|
+
uses: hekivo/gha-workflows/actions/deploy-rsync@v1
|
|
344
|
+
with:
|
|
345
|
+
ssh-target: ${{'{{'}} env.SSH_USER {{'}}'}}@${{'{{'}} env.SSH_HOST {{'}}'}}
|
|
346
|
+
ssh-cmd: ssh -p ${{'{{'}} env.SSH_PORT || '22' {{'}}'}}
|
|
347
|
+
remote-root: ${{'{{'}} env.SSH_REMOTE_PATH {{'}}'}}
|
|
348
|
+
{{#if ci.build.sage}}
|
|
349
|
+
theme-slug: {{projectName}}
|
|
350
|
+
{{/if}}
|
|
351
|
+
|
|
352
|
+
- name: WordPress post-deploy
|
|
353
|
+
uses: hekivo/gha-workflows/actions/wp-post-deploy@v1
|
|
354
|
+
with:
|
|
355
|
+
ssh-target: ${{'{{'}} env.SSH_USER {{'}}'}}@${{'{{'}} env.SSH_HOST {{'}}'}}
|
|
356
|
+
ssh-cmd: ssh -p ${{'{{'}} env.SSH_PORT || '22' {{'}}'}}
|
|
357
|
+
remote-root: ${{'{{'}} env.SSH_REMOTE_PATH {{'}}'}}
|
|
358
|
+
{{#if enable_acf_pro}}
|
|
359
|
+
plugin-slug: advanced-custom-fields-pro
|
|
360
|
+
{{/if}}
|
|
361
|
+
{{#if ci.build.sage}}
|
|
362
|
+
theme-slug: {{projectName}}
|
|
363
|
+
{{/if}}
|
|
364
|
+
|
|
365
|
+
- name: Purge Cloudflare cache
|
|
366
|
+
uses: hekivo/gha-workflows/actions/cloudflare-purge@v1
|
|
367
|
+
with:
|
|
368
|
+
zone-id: ${{'{{'}} env.CLOUDFLARE_PURGE_ZONE_ID {{'}}'}}
|
|
369
|
+
api-token: ${{'{{'}} env.CLOUDFLARE_PURGE_TOKEN {{'}}'}}
|
|
370
|
+
{{/if}}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{#if ci.lint.blank_theme}}
|
|
2
|
-
lint:blank-theme:
|
|
2
|
+
lint:blank-theme:js:
|
|
3
3
|
stage: lint
|
|
4
4
|
image: node:${NODE_VERSION}-alpine
|
|
5
5
|
variables:
|
|
@@ -7,9 +7,9 @@ lint:blank-theme:eslint:
|
|
|
7
7
|
before_script:
|
|
8
8
|
- apk add --no-cache git
|
|
9
9
|
script:
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
- npx
|
|
10
|
+
- npm ci
|
|
11
|
+
- npx oxfmt --check
|
|
12
|
+
- npx oxlint
|
|
13
13
|
rules:
|
|
14
14
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
15
15
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{#if ci.lint.mu_plugin}}
|
|
2
|
-
lint:mu-plugin:
|
|
2
|
+
lint:mu-plugin:quality:
|
|
3
3
|
stage: lint
|
|
4
4
|
image: php:${PHP_VERSION}-cli
|
|
5
5
|
variables:
|
|
@@ -10,7 +10,8 @@ lint:mu-plugin:pint:
|
|
|
10
10
|
script:
|
|
11
11
|
- cd $PLUGIN_DIR
|
|
12
12
|
- composer install --no-dev
|
|
13
|
-
-
|
|
13
|
+
- vendor/bin/mago format --check
|
|
14
|
+
- vendor/bin/mago lint
|
|
14
15
|
rules:
|
|
15
16
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
16
17
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{#if ci.lint.plugin}}
|
|
2
|
-
lint:plugin:
|
|
2
|
+
lint:plugin:quality:
|
|
3
3
|
stage: lint
|
|
4
4
|
image: php:${PHP_VERSION}-cli
|
|
5
5
|
variables:
|
|
@@ -10,7 +10,8 @@ lint:plugin:pint:
|
|
|
10
10
|
script:
|
|
11
11
|
- cd $PLUGIN_DIR
|
|
12
12
|
- composer install --no-dev
|
|
13
|
-
-
|
|
13
|
+
- vendor/bin/mago format --check
|
|
14
|
+
- vendor/bin/mago lint
|
|
14
15
|
rules:
|
|
15
16
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
16
17
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
@@ -1,44 +1,47 @@
|
|
|
1
1
|
{{#if ci.lint.sage}}
|
|
2
|
-
lint:sage:
|
|
2
|
+
lint:sage:quality:
|
|
3
3
|
stage: lint
|
|
4
|
-
image:
|
|
4
|
+
image: php:${PHP_VERSION}-cli
|
|
5
5
|
before_script:
|
|
6
|
-
-
|
|
6
|
+
- apt-get update -qq && apt-get install -qq --no-install-recommends git unzip
|
|
7
|
+
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
7
8
|
script:
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- composer install --no-dev --optimize-autoloader
|
|
10
|
+
- vendor/bin/mago format --check
|
|
11
|
+
- vendor/bin/mago lint
|
|
11
12
|
rules:
|
|
12
13
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
13
14
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
14
15
|
- if: $CI_COMMIT_BRANCH == "staging"
|
|
15
16
|
- if: $CI_COMMIT_BRANCH == "develop"
|
|
16
17
|
|
|
17
|
-
lint:sage:
|
|
18
|
+
lint:sage:js:
|
|
18
19
|
stage: lint
|
|
19
20
|
image: node:${NODE_VERSION}-alpine
|
|
20
21
|
before_script:
|
|
21
22
|
- apk add --no-cache git
|
|
22
23
|
script:
|
|
24
|
+
- npm ci
|
|
25
|
+
- npx oxfmt --check
|
|
26
|
+
- npx oxlint
|
|
23
27
|
- cd {{ci.theme.paths.themeRoot}}
|
|
24
28
|
- npm ci --cache .npm --prefer-offline
|
|
25
|
-
-
|
|
29
|
+
- npm run build
|
|
26
30
|
rules:
|
|
27
31
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
28
32
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
29
33
|
- if: $CI_COMMIT_BRANCH == "staging"
|
|
30
34
|
- if: $CI_COMMIT_BRANCH == "develop"
|
|
31
35
|
|
|
32
|
-
lint:sage:
|
|
36
|
+
lint:sage:stylelint:
|
|
33
37
|
stage: lint
|
|
34
|
-
image:
|
|
38
|
+
image: node:${NODE_VERSION}-alpine
|
|
35
39
|
before_script:
|
|
36
|
-
-
|
|
37
|
-
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
40
|
+
- apk add --no-cache git
|
|
38
41
|
script:
|
|
39
42
|
- cd {{ci.theme.paths.themeRoot}}
|
|
40
|
-
-
|
|
41
|
-
-
|
|
43
|
+
- npm ci --cache .npm --prefer-offline
|
|
44
|
+
- npx stylelint "resources/**/*.{css,scss}"
|
|
42
45
|
rules:
|
|
43
46
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
44
47
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"*.{js,
|
|
3
|
-
"*.{
|
|
4
|
-
"*.{json,yaml,yml,md}": "prettier --check",
|
|
5
|
-
"*.{html}": "prettier --check --parser html",
|
|
6
|
-
"*.{php}": "pint --test"
|
|
2
|
+
"*.{js,mjs,ts,vue,jsx,tsx}": ["oxfmt --write", "oxlint --fix"],
|
|
3
|
+
"*.{json,jsonc,html,yml,yaml,md,mdx}": ["oxfmt --write"]
|
|
7
4
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"ignorePatterns": [
|
|
4
|
+
"node_modules/**",
|
|
5
|
+
"vendor/**",
|
|
6
|
+
"content/themes/*/public/build/**",
|
|
7
|
+
"content/themes/*/node_modules/**",
|
|
8
|
+
"content/themes/*/vendor/**",
|
|
9
|
+
"wp/**",
|
|
10
|
+
"content/plugins/**",
|
|
11
|
+
"content/mu-plugins/**",
|
|
12
|
+
"public/build/**",
|
|
13
|
+
"test-results/**",
|
|
14
|
+
"playwright-report/**"
|
|
15
|
+
],
|
|
16
|
+
"rules": {
|
|
17
|
+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
# Read by both Prettier (legacy) and oxfmt (current).
|
|
2
|
+
# oxfmt automatically picks this file up by default (and .gitignore).
|
|
3
|
+
|
|
1
4
|
# Node & Composer
|
|
2
5
|
node_modules/
|
|
3
6
|
vendor/
|
|
4
7
|
|
|
5
|
-
#
|
|
8
|
+
# Theme/plugin/mu-plugin subtrees are formatted by their own
|
|
9
|
+
# lint-staged globs targeting specific paths via mago/oxfmt — skip
|
|
10
|
+
# the whole subtree here so we never accidentally reformat vendored code.
|
|
6
11
|
content/themes/
|
|
7
12
|
content/mu-plugins/
|
|
8
13
|
content/plugins/
|
|
@@ -17,6 +22,8 @@ content/cache/
|
|
|
17
22
|
public/build/
|
|
18
23
|
dist/
|
|
19
24
|
.lando/
|
|
25
|
+
test-results/
|
|
26
|
+
playwright-report/
|
|
20
27
|
|
|
21
28
|
# Env and logs
|
|
22
29
|
.env
|
|
@@ -24,3 +31,11 @@ dist/
|
|
|
24
31
|
*.log
|
|
25
32
|
*.tmp
|
|
26
33
|
*.bak
|
|
34
|
+
|
|
35
|
+
# Auto-generated lock files (oxfmt would normalize whitespace and
|
|
36
|
+
# defeat npm/composer determinism). Both are still committed.
|
|
37
|
+
package-lock.json
|
|
38
|
+
composer.lock
|
|
39
|
+
|
|
40
|
+
# Auto-generated by semantic-release / release-please.
|
|
41
|
+
CHANGELOG.md
|