@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,15 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
"author": "{{author}}",
|
|
3
|
+
"description": "{{projectDescription}}",
|
|
4
|
+
"version": "{{projectVersion}}",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"private": true,
|
|
7
|
+
"type": "module",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20.0.0"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "{{gitRepository}}"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"dev": "vite",
|
|
17
|
+
"build": "vite build",
|
|
18
|
+
"translate": "npm run translate:pot && npm run translate:update",
|
|
19
|
+
"translate:pot": "wp i18n make-pot . ./resources/lang/sage.pot --include=\"theme.json,patterns,app,resources\"",
|
|
20
|
+
"translate:update": "for file in ./resources/lang/*.po; do wp i18n update-po ./resources/lang/sage.pot $file; done",
|
|
21
|
+
"translate:compile": "npm run translate:mo && npm run translate:js",
|
|
22
|
+
"translate:js": "wp i18n make-json ./resources/lang --pretty-print",
|
|
23
|
+
"translate:mo": "wp i18n make-mo ./resources/lang ./resources/lang",
|
|
24
|
+
"lint": "eslint resources --ext .js,.ts,.vue"
|
|
25
|
+
}
|
|
15
26
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codigodoleo/wp-kit",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Kit opinativo para padronizar projetos WordPress com CI/CD dinâmico.",
|
|
5
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"codigodoleo",
|
|
7
|
+
"devops",
|
|
8
|
+
"kit",
|
|
9
|
+
"leo",
|
|
10
|
+
"scaffold",
|
|
11
|
+
"wordpress"
|
|
12
|
+
],
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"author": "Leo (@codigodoleo)",
|
|
6
15
|
"bin": {
|
|
7
16
|
"leo-wp": "./bin/index.js",
|
|
8
17
|
"wp-kit": "./bin/index.js"
|
|
9
18
|
},
|
|
10
|
-
"publishConfig": {
|
|
11
|
-
"access": "public"
|
|
12
|
-
},
|
|
13
19
|
"files": [
|
|
14
20
|
"bin/",
|
|
15
21
|
"lib/",
|
|
@@ -21,11 +27,16 @@
|
|
|
21
27
|
".cspell.json",
|
|
22
28
|
".gitkeep"
|
|
23
29
|
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"main": "bin/index.js",
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
24
35
|
"scripts": {
|
|
25
36
|
"prepare": "husky install",
|
|
26
|
-
"lint": "
|
|
27
|
-
"lint:fix": "
|
|
28
|
-
"format": "
|
|
37
|
+
"lint": "oxlint .",
|
|
38
|
+
"lint:fix": "oxlint . --fix",
|
|
39
|
+
"format": "oxfmt --write .",
|
|
29
40
|
"commit": "cz",
|
|
30
41
|
"test:setup": "npm run test:clean && npm run test:scaffold",
|
|
31
42
|
"test:clean": "rm -rf __test-sandbox__",
|
|
@@ -38,47 +49,31 @@
|
|
|
38
49
|
"test:e2e:all": "bash scripts/validate-e2e.sh all",
|
|
39
50
|
"open-cursor": "cursor ./__test-sandbox__/test-project/wordpress-dev.code-workspace"
|
|
40
51
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"license": "ISC",
|
|
51
|
-
"type": "module",
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"chalk": "^5.4.1",
|
|
54
|
+
"commander": "^14.0.0",
|
|
55
|
+
"fs-extra": "^11.3.0",
|
|
56
|
+
"handlebars": "^4.7.8",
|
|
57
|
+
"inquirer": "^12.7.0",
|
|
58
|
+
"js-yaml": "^4.1.0",
|
|
59
|
+
"lodash.mergewith": "^4.6.2"
|
|
60
|
+
},
|
|
52
61
|
"devDependencies": {
|
|
53
62
|
"@commitlint/cli": "^18.4.3",
|
|
54
63
|
"@commitlint/config-conventional": "^18.4.3",
|
|
55
64
|
"@commitlint/prompt": "^18.4.3",
|
|
56
65
|
"@cspell/dict-php": "^4.0.14",
|
|
57
66
|
"@cspell/dict-pt-br": "^2.4.0",
|
|
58
|
-
"@eslint/js": "^9.30.1",
|
|
59
67
|
"commitizen": "^4.3.0",
|
|
60
68
|
"conventional-changelog-cli": "^4.1.0",
|
|
61
|
-
"eslint": "^9.30.1",
|
|
62
|
-
"eslint-config-prettier": "^10.1.5",
|
|
63
|
-
"eslint-plugin-import": "^2.32.0",
|
|
64
|
-
"eslint-plugin-prettier": "^5.2.0",
|
|
65
|
-
"globals": "^16.3.0",
|
|
66
69
|
"husky": "^8.0.3",
|
|
67
70
|
"lint-staged": "^15.2.1",
|
|
68
|
-
"
|
|
71
|
+
"oxfmt": "^0.52.0",
|
|
72
|
+
"oxlint": "^1.67.0",
|
|
69
73
|
"standard-version": "^9.5.0",
|
|
70
74
|
"stylelint": "^16.21.1",
|
|
71
75
|
"stylelint-config-standard-scss": "^15.0.1"
|
|
72
76
|
},
|
|
73
|
-
"dependencies": {
|
|
74
|
-
"chalk": "^5.4.1",
|
|
75
|
-
"commander": "^14.0.0",
|
|
76
|
-
"fs-extra": "^11.3.0",
|
|
77
|
-
"handlebars": "^4.7.8",
|
|
78
|
-
"inquirer": "^12.7.0",
|
|
79
|
-
"js-yaml": "^4.1.0",
|
|
80
|
-
"lodash.mergewith": "^4.6.2"
|
|
81
|
-
},
|
|
82
77
|
"config": {
|
|
83
78
|
"commitizen": {
|
|
84
79
|
"path": "@commitlint/prompt"
|
package/templates/.gitignore.hbs
CHANGED
|
@@ -12,15 +12,21 @@
|
|
|
12
12
|
"wpackagist": {
|
|
13
13
|
"type": "composer",
|
|
14
14
|
"url": "https://wpackagist.org"
|
|
15
|
-
}
|
|
15
|
+
}{{#if enable_acf_pro}},
|
|
16
|
+
"acf-pro": {
|
|
17
|
+
"type": "composer",
|
|
18
|
+
"url": "https://connect.advancedcustomfields.com"
|
|
19
|
+
}{{/if}}
|
|
16
20
|
},
|
|
17
21
|
"license": "MIT",
|
|
18
22
|
"require": {
|
|
19
23
|
"php": ">={{phpVersion}}",
|
|
20
24
|
"roots/wordpress": "{{wpCoreVersion}}",
|
|
21
|
-
"roots/bedrock-autoloader": "
|
|
22
|
-
"inpsyde/wp-translation-downloader": "
|
|
23
|
-
"vlucas/phpdotenv": "
|
|
25
|
+
"roots/bedrock-autoloader": "1.0",
|
|
26
|
+
"inpsyde/wp-translation-downloader": "2.5",
|
|
27
|
+
"vlucas/phpdotenv": "5.5"{{#if enable_acf_pro}},
|
|
28
|
+
"wordpress/mcp-adapter": "0.5.0",
|
|
29
|
+
"wpengine/advanced-custom-fields-pro": "^6.4"{{/if}}
|
|
24
30
|
},
|
|
25
31
|
"config": {
|
|
26
32
|
"allow-plugins": {
|
|
@@ -56,5 +62,7 @@
|
|
|
56
62
|
}
|
|
57
63
|
]
|
|
58
64
|
}
|
|
59
|
-
}
|
|
65
|
+
},
|
|
66
|
+
"minimum-stability": "dev",
|
|
67
|
+
"prefer-stable": true
|
|
60
68
|
}
|
|
@@ -22,10 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@cspell/dict-php": "^4.0.14",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"eslint-plugin-import": "^2.32.0",
|
|
28
|
-
"prettier": "^3.6.2",
|
|
25
|
+
"oxfmt": "^0.52.0",
|
|
26
|
+
"oxlint": "^1.67.0",
|
|
29
27
|
"stylelint": "^16.21.1",
|
|
30
28
|
"stylelint-config-standard-scss": "^15.0.1"
|
|
31
29
|
},
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"git.allowNoVerifyCommit": false,
|
|
18
18
|
"editor.formatOnSave": false,
|
|
19
19
|
"editor.codeActionsOnSave": {
|
|
20
|
-
"source.fixAll
|
|
20
|
+
"source.fixAll": "explicit",
|
|
21
21
|
"source.organizeImports": "explicit"
|
|
22
22
|
},
|
|
23
23
|
"editor.tabSize": 4,
|
|
@@ -56,10 +56,9 @@
|
|
|
56
56
|
"bmewburn.vscode-intelephense-client",
|
|
57
57
|
"wordpresstoolbox.wordpress-toolbox",
|
|
58
58
|
"tungvn.wordpress-snippet",
|
|
59
|
-
"
|
|
59
|
+
"carthage-software.mago",
|
|
60
|
+
"oxc.oxc-vscode",
|
|
60
61
|
"felixfbecker.php-debug",
|
|
61
|
-
"esbenp.prettier-vscode",
|
|
62
|
-
"dbaeumer.vscode-eslint",
|
|
63
62
|
"bradlc.vscode-tailwindcss",
|
|
64
63
|
"ms-azuretools.vscode-docker",
|
|
65
64
|
"ms-vscode-remote.remote-containers",
|
package/wp-config.php
CHANGED
|
@@ -47,6 +47,11 @@ if (!function_exists('getenv_docker')) {
|
|
|
47
47
|
return rtrim(file_get_contents($fileEnv), "\r\n");
|
|
48
48
|
} else if (($val = getenv($env)) !== false) {
|
|
49
49
|
return $val;
|
|
50
|
+
} else if (isset($_ENV[$env])) {
|
|
51
|
+
// phpdotenv 5.x doesn't populate putenv() — fall back to $_ENV
|
|
52
|
+
// so PHP-FPM / WP-CLI / cron all see the .env values outside
|
|
53
|
+
// Lando (which sets its own env vars at container start).
|
|
54
|
+
return $_ENV[$env];
|
|
50
55
|
} else {
|
|
51
56
|
return $default;
|
|
52
57
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
|
3
|
-
import prettierPlugin from 'eslint-plugin-prettier';
|
|
4
|
-
import globals from 'globals';
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
{
|
|
8
|
-
ignores: ['node_modules/**', 'vendor/**', 'dist/**'],
|
|
9
|
-
},
|
|
10
|
-
js.configs.recommended,
|
|
11
|
-
{
|
|
12
|
-
files: ['src/js/**/*.{js,mjs,ts}'],
|
|
13
|
-
languageOptions: {
|
|
14
|
-
ecmaVersion: 2022,
|
|
15
|
-
sourceType: 'module',
|
|
16
|
-
globals: {
|
|
17
|
-
...globals.browser,
|
|
18
|
-
...globals.node,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
plugins: {
|
|
22
|
-
prettier: prettierPlugin,
|
|
23
|
-
},
|
|
24
|
-
rules: {
|
|
25
|
-
'prettier/prettier': 'error',
|
|
26
|
-
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
eslintConfigPrettier,
|
|
30
|
-
];
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# Reusable workflow — Docker Build & Push to Container Registry
|
|
2
|
-
#
|
|
3
|
-
# Como usar no seu workflow principal (.github/workflows/main.yml):
|
|
4
|
-
#
|
|
5
|
-
# on:
|
|
6
|
-
# push:
|
|
7
|
-
# branches: [main]
|
|
8
|
-
#
|
|
9
|
-
# jobs:
|
|
10
|
-
# deploy:
|
|
11
|
-
# uses: ./.github/workflows/deploy-docker.yml
|
|
12
|
-
# with:
|
|
13
|
-
# registry: ghcr.io # opcional — default: ghcr.io
|
|
14
|
-
# # registry: docker.io # para Docker Hub
|
|
15
|
-
# secrets:
|
|
16
|
-
# REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GHCR usa GITHUB_TOKEN
|
|
17
|
-
# # REGISTRY_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} # Docker Hub
|
|
18
|
-
#
|
|
19
|
-
# Secrets necessários (Settings → Secrets → Actions):
|
|
20
|
-
# REGISTRY_TOKEN — token de autenticação no registry (GITHUB_TOKEN é suficiente para GHCR)
|
|
21
|
-
|
|
22
|
-
name: Deploy (Docker)
|
|
23
|
-
|
|
24
|
-
on:
|
|
25
|
-
workflow_call:
|
|
26
|
-
inputs:
|
|
27
|
-
registry:
|
|
28
|
-
description: 'Container registry (ghcr.io ou docker.io)'
|
|
29
|
-
required: false
|
|
30
|
-
type: string
|
|
31
|
-
default: ghcr.io
|
|
32
|
-
image-name:
|
|
33
|
-
description: 'Nome da imagem (default: github.repository em lowercase)'
|
|
34
|
-
required: false
|
|
35
|
-
type: string
|
|
36
|
-
default: ''
|
|
37
|
-
dockerfile:
|
|
38
|
-
description: 'Caminho para o Dockerfile'
|
|
39
|
-
required: false
|
|
40
|
-
type: string
|
|
41
|
-
default: Dockerfile
|
|
42
|
-
context:
|
|
43
|
-
description: 'Contexto do build Docker'
|
|
44
|
-
required: false
|
|
45
|
-
type: string
|
|
46
|
-
default: '.'
|
|
47
|
-
secrets:
|
|
48
|
-
REGISTRY_TOKEN:
|
|
49
|
-
required: false
|
|
50
|
-
|
|
51
|
-
permissions:
|
|
52
|
-
contents: read
|
|
53
|
-
packages: write
|
|
54
|
-
|
|
55
|
-
jobs:
|
|
56
|
-
build-push:
|
|
57
|
-
name: Build & Push
|
|
58
|
-
runs-on: ubuntu-latest
|
|
59
|
-
env:
|
|
60
|
-
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
61
|
-
steps:
|
|
62
|
-
- name: Checkout
|
|
63
|
-
uses: actions/checkout@v4
|
|
64
|
-
|
|
65
|
-
- name: Resolve image name
|
|
66
|
-
id: image
|
|
67
|
-
run: |
|
|
68
|
-
NAME="${{ inputs.image-name }}"
|
|
69
|
-
[ -z "$NAME" ] && NAME="${{ github.repository }}"
|
|
70
|
-
echo "name=${NAME,,}" >> $GITHUB_OUTPUT
|
|
71
|
-
|
|
72
|
-
- name: Set up QEMU
|
|
73
|
-
uses: docker/setup-qemu-action@v3
|
|
74
|
-
|
|
75
|
-
- name: Set up Docker Buildx
|
|
76
|
-
uses: docker/setup-buildx-action@v3
|
|
77
|
-
|
|
78
|
-
- name: Log in to registry
|
|
79
|
-
uses: docker/login-action@v3
|
|
80
|
-
with:
|
|
81
|
-
registry: ${{ inputs.registry }}
|
|
82
|
-
username: ${{ github.actor }}
|
|
83
|
-
password: ${{ secrets.REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}
|
|
84
|
-
|
|
85
|
-
- name: Extract Docker metadata
|
|
86
|
-
id: meta
|
|
87
|
-
uses: docker/metadata-action@v5
|
|
88
|
-
with:
|
|
89
|
-
images: ${{ inputs.registry }}/${{ steps.image.outputs.name }}
|
|
90
|
-
tags: |
|
|
91
|
-
type=ref,event=branch
|
|
92
|
-
type=semver,pattern={{version}}
|
|
93
|
-
type=sha,prefix=sha-,format=short
|
|
94
|
-
|
|
95
|
-
- name: Build and push
|
|
96
|
-
uses: docker/build-push-action@v6
|
|
97
|
-
with:
|
|
98
|
-
context: ${{ inputs.context }}
|
|
99
|
-
file: ${{ inputs.dockerfile }}
|
|
100
|
-
push: true
|
|
101
|
-
tags: ${{ steps.meta.outputs.tags }}
|
|
102
|
-
labels: ${{ steps.meta.outputs.labels }}
|
|
103
|
-
cache-from: type=gha
|
|
104
|
-
cache-to: type=gha,mode=max
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# Reusable workflow — SSH Deploy via rsync
|
|
2
|
-
#
|
|
3
|
-
# Como usar no seu workflow principal (.github/workflows/main.yml):
|
|
4
|
-
#
|
|
5
|
-
# on:
|
|
6
|
-
# push:
|
|
7
|
-
# branches: [main]
|
|
8
|
-
#
|
|
9
|
-
# jobs:
|
|
10
|
-
# deploy:
|
|
11
|
-
# uses: ./.github/workflows/deploy-ssh.yml
|
|
12
|
-
# with:
|
|
13
|
-
# host: meu-servidor.example.com
|
|
14
|
-
# user: deploy
|
|
15
|
-
# remote-path: /var/www/html
|
|
16
|
-
# theme-path: content/themes/meu-tema # opcional, para projetos com Sage
|
|
17
|
-
# secrets:
|
|
18
|
-
# SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
19
|
-
# SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
|
|
20
|
-
#
|
|
21
|
-
# Secrets necessários (Settings → Secrets → Actions):
|
|
22
|
-
# SSH_PRIVATE_KEY — chave SSH privada (gerada sem passphrase para CI)
|
|
23
|
-
# SSH_KNOWN_HOSTS — saída de: ssh-keyscan -H <host>
|
|
24
|
-
#
|
|
25
|
-
# Permissões no servidor — o rsync usa --no-perms --no-owner --no-group,
|
|
26
|
-
# portanto não altera permissões/proprietários existentes no destino.
|
|
27
|
-
|
|
28
|
-
name: Deploy (SSH + rsync)
|
|
29
|
-
|
|
30
|
-
on:
|
|
31
|
-
workflow_call:
|
|
32
|
-
inputs:
|
|
33
|
-
host:
|
|
34
|
-
description: 'Endereço do servidor de destino'
|
|
35
|
-
required: true
|
|
36
|
-
type: string
|
|
37
|
-
user:
|
|
38
|
-
description: 'Usuário SSH no servidor'
|
|
39
|
-
required: true
|
|
40
|
-
type: string
|
|
41
|
-
remote-path:
|
|
42
|
-
description: 'Caminho absoluto no servidor de destino'
|
|
43
|
-
required: true
|
|
44
|
-
type: string
|
|
45
|
-
php-version:
|
|
46
|
-
description: 'Versão do PHP para instalar dependências Composer'
|
|
47
|
-
required: false
|
|
48
|
-
type: string
|
|
49
|
-
default: '8.3'
|
|
50
|
-
node-version:
|
|
51
|
-
description: 'Versão do Node.js para build de assets'
|
|
52
|
-
required: false
|
|
53
|
-
type: string
|
|
54
|
-
default: '22'
|
|
55
|
-
theme-path:
|
|
56
|
-
description: 'Caminho relativo do tema para build (vazio = sem build de tema)'
|
|
57
|
-
required: false
|
|
58
|
-
type: string
|
|
59
|
-
default: ''
|
|
60
|
-
rsync-excludes:
|
|
61
|
-
description: 'Caminhos a excluir do rsync, separados por vírgula'
|
|
62
|
-
required: false
|
|
63
|
-
type: string
|
|
64
|
-
default: '.git,.env,node_modules/.cache'
|
|
65
|
-
secrets:
|
|
66
|
-
SSH_PRIVATE_KEY:
|
|
67
|
-
required: true
|
|
68
|
-
SSH_KNOWN_HOSTS:
|
|
69
|
-
required: true
|
|
70
|
-
|
|
71
|
-
jobs:
|
|
72
|
-
build-and-deploy:
|
|
73
|
-
name: Build & Deploy via SSH
|
|
74
|
-
runs-on: ubuntu-latest
|
|
75
|
-
env:
|
|
76
|
-
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
77
|
-
steps:
|
|
78
|
-
- name: Checkout
|
|
79
|
-
uses: actions/checkout@v4
|
|
80
|
-
with:
|
|
81
|
-
fetch-depth: 0
|
|
82
|
-
|
|
83
|
-
- name: Setup PHP
|
|
84
|
-
uses: shivammathur/setup-php@v2
|
|
85
|
-
with:
|
|
86
|
-
php-version: ${{ inputs.php-version }}
|
|
87
|
-
|
|
88
|
-
- name: Install Composer dependencies
|
|
89
|
-
run: composer install --no-dev --optimize-autoloader --no-interaction
|
|
90
|
-
|
|
91
|
-
- name: Setup Node.js
|
|
92
|
-
if: inputs.theme-path != ''
|
|
93
|
-
uses: actions/setup-node@v4
|
|
94
|
-
with:
|
|
95
|
-
node-version: ${{ inputs.node-version }}
|
|
96
|
-
cache: 'npm'
|
|
97
|
-
cache-dependency-path: ${{ inputs.theme-path }}/package-lock.json
|
|
98
|
-
|
|
99
|
-
- name: Build theme assets
|
|
100
|
-
if: inputs.theme-path != ''
|
|
101
|
-
run: |
|
|
102
|
-
npm install --prefix "${{ inputs.theme-path }}"
|
|
103
|
-
npm run build --prefix "${{ inputs.theme-path }}"
|
|
104
|
-
|
|
105
|
-
- name: Configure SSH agent
|
|
106
|
-
uses: webfactory/ssh-agent@v0.9.0
|
|
107
|
-
with:
|
|
108
|
-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
109
|
-
|
|
110
|
-
- name: Add known hosts
|
|
111
|
-
run: |
|
|
112
|
-
mkdir -p ~/.ssh
|
|
113
|
-
echo "${{ secrets.SSH_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
|
|
114
|
-
chmod 600 ~/.ssh/known_hosts
|
|
115
|
-
|
|
116
|
-
- name: Deploy via rsync
|
|
117
|
-
run: |
|
|
118
|
-
EXCLUDE_ARGS=""
|
|
119
|
-
IFS=',' read -ra ITEMS <<< "${{ inputs.rsync-excludes }}"
|
|
120
|
-
for item in "${ITEMS[@]}"; do
|
|
121
|
-
EXCLUDE_ARGS="$EXCLUDE_ARGS --exclude=${item// /}"
|
|
122
|
-
done
|
|
123
|
-
|
|
124
|
-
rsync -avz --delete \
|
|
125
|
-
$EXCLUDE_ARGS \
|
|
126
|
-
--no-perms --no-owner --no-group \
|
|
127
|
-
./ \
|
|
128
|
-
"${{ inputs.user }}@${{ inputs.host }}:${{ inputs.remote-path }}/"
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Reusable workflow — Semantic Release
|
|
2
|
-
#
|
|
3
|
-
# Como usar no seu workflow principal (.github/workflows/main.yml):
|
|
4
|
-
#
|
|
5
|
-
# on:
|
|
6
|
-
# push:
|
|
7
|
-
# branches: [main]
|
|
8
|
-
#
|
|
9
|
-
# jobs:
|
|
10
|
-
# release:
|
|
11
|
-
# uses: ./.github/workflows/release.yml
|
|
12
|
-
# secrets:
|
|
13
|
-
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # opcional para projetos WordPress
|
|
14
|
-
#
|
|
15
|
-
# GITHUB_TOKEN é injetado automaticamente com os devidos escopos.
|
|
16
|
-
|
|
17
|
-
name: Semantic Release (reusable)
|
|
18
|
-
|
|
19
|
-
on:
|
|
20
|
-
workflow_call:
|
|
21
|
-
secrets:
|
|
22
|
-
NPM_TOKEN:
|
|
23
|
-
required: false
|
|
24
|
-
|
|
25
|
-
permissions:
|
|
26
|
-
contents: write
|
|
27
|
-
issues: write
|
|
28
|
-
pull-requests: write
|
|
29
|
-
id-token: write
|
|
30
|
-
|
|
31
|
-
jobs:
|
|
32
|
-
release:
|
|
33
|
-
name: Semantic Release
|
|
34
|
-
runs-on: ubuntu-latest
|
|
35
|
-
env:
|
|
36
|
-
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
37
|
-
steps:
|
|
38
|
-
- name: Checkout
|
|
39
|
-
uses: actions/checkout@v4
|
|
40
|
-
with:
|
|
41
|
-
fetch-depth: 0
|
|
42
|
-
persist-credentials: false
|
|
43
|
-
|
|
44
|
-
- name: Setup Node.js
|
|
45
|
-
uses: actions/setup-node@v4
|
|
46
|
-
with:
|
|
47
|
-
node-version: '24'
|
|
48
|
-
cache: 'npm'
|
|
49
|
-
|
|
50
|
-
- name: Install dependencies
|
|
51
|
-
run: npm ci
|
|
52
|
-
|
|
53
|
-
- name: Release
|
|
54
|
-
run: npx semantic-release
|
|
55
|
-
env:
|
|
56
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
57
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
|
3
|
-
import prettierPlugin from 'eslint-plugin-prettier';
|
|
4
|
-
import globals from 'globals';
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
{
|
|
8
|
-
ignores: ['node_modules/**', 'vendor/**', 'dist/**'],
|
|
9
|
-
},
|
|
10
|
-
js.configs.recommended,
|
|
11
|
-
{
|
|
12
|
-
files: ['resources/**/*.{js,mjs,ts}'],
|
|
13
|
-
languageOptions: {
|
|
14
|
-
ecmaVersion: 2022,
|
|
15
|
-
sourceType: 'module',
|
|
16
|
-
globals: {
|
|
17
|
-
...globals.browser,
|
|
18
|
-
...globals.node,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
plugins: {
|
|
22
|
-
prettier: prettierPlugin,
|
|
23
|
-
},
|
|
24
|
-
rules: {
|
|
25
|
-
'prettier/prettier': 'error',
|
|
26
|
-
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
eslintConfigPrettier,
|
|
30
|
-
];
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
|
3
|
-
import prettierPlugin from 'eslint-plugin-prettier';
|
|
4
|
-
import globals from 'globals';
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
{
|
|
8
|
-
ignores: ['node_modules/**', 'vendor/**', 'dist/**'],
|
|
9
|
-
},
|
|
10
|
-
js.configs.recommended,
|
|
11
|
-
{
|
|
12
|
-
files: ['resources/**/*.{js,mjs,ts}'],
|
|
13
|
-
languageOptions: {
|
|
14
|
-
ecmaVersion: 2022,
|
|
15
|
-
sourceType: 'module',
|
|
16
|
-
globals: {
|
|
17
|
-
...globals.browser,
|
|
18
|
-
...globals.node,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
plugins: {
|
|
22
|
-
prettier: prettierPlugin,
|
|
23
|
-
},
|
|
24
|
-
rules: {
|
|
25
|
-
'prettier/prettier': 'error',
|
|
26
|
-
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
eslintConfigPrettier,
|
|
30
|
-
];
|