Template
Compare commits
105 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6cb36784bb | |||
| a7fe9db66c | |||
| 618350dc2e | |||
| d93c69da9d | |||
| c84fd09e18 | |||
| 95ea7cee8c | |||
| 718d57bd1e | |||
| 7b86c2c16a | |||
| abe2c102fd | |||
| 44f03ddcd8 | |||
| d2e7d85e16 | |||
| a71170addf | |||
| 393677927f | |||
| 351d847619 | |||
| 9927926295 | |||
| 7ad8efe281 | |||
| e498b22b66 | |||
| be2298f6ec | |||
| 70420bec71 | |||
| 478582ba0f | |||
| 2cf42b79b7 | |||
| d46c431189 | |||
| 08a3e7b089 | |||
| d3fa17430f | |||
| de1b38213f | |||
| 10db4fe33a | |||
| dbf24e304b | |||
| b4c1065b57 | |||
| 8cd6c4626f | |||
| 757887ea11 | |||
| 7efc4731f9 | |||
| d883177b88 | |||
| 286b35fabf | |||
| da7621a7ab | |||
| 219668fd3c | |||
| dcbd33a72f | |||
| 6b6cca5761 | |||
| cd6d218e76 | |||
| c8f993c3e2 | |||
| d813100190 | |||
| cd58400dff | |||
| 3f8a5d8ec5 | |||
| 997f6c4181 | |||
| 3f0deac20e | |||
| 9964310cae | |||
| b1862ba8c7 | |||
| dba9f1c6a2 | |||
| 2ee87395c1 | |||
| 9444684322 | |||
| 90b632912b | |||
| 3d8ec08abd | |||
| db2899b3b3 | |||
| b41ed2caa5 | |||
| 66da3fa30c | |||
| 36015389a4 | |||
| 825236f94b | |||
| f243386d8d | |||
| 48ee0ce5bb | |||
| 14a3216995 | |||
| f40094f757 | |||
| 4340e3a811 | |||
| bb739b304a | |||
| 628b0d4e8b | |||
| 8e8c4901df | |||
| 69ac75e35b | |||
| ba3cefa470 | |||
| 92639daf5d | |||
| 56e6ce00ae | |||
| d678a7d480 | |||
| af066d8438 | |||
| b3b581c9c1 | |||
| 5fa03c971d | |||
| 3fccd56aec | |||
| 764b98da58 | |||
| 9c03136d6d | |||
| 64566e71b5 | |||
| e5fdf206b7 | |||
| 749a5140ba | |||
| 65a6788ed0 | |||
| a2ca2cc53d | |||
| c4ba1e4c06 | |||
| 08c121a6f2 | |||
| b536118817 | |||
| da816d348d | |||
| 0ddb771dca | |||
| bfd34be3cd | |||
| c90ab96a2e | |||
| a1d0b031f1 | |||
| 0f52a81692 | |||
| b79a16336f | |||
| 98020c8d15 | |||
| dd4fa3b26f | |||
| b6fdffc4be | |||
| 4d4ff631bd | |||
| f91f419063 | |||
| 9296d11f30 | |||
| efcc525064 | |||
| c7e253049a | |||
| 6d721fd089 | |||
| db7ed7fa59 | |||
| 1b56994f16 | |||
| 51807ff944 | |||
| 5cd184a7dc | |||
| a02da1ad84 | |||
| 73628c509b |
+7
-1
@@ -180,7 +180,7 @@ __pycache__/
|
|||||||
*.egg
|
*.egg
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
MANIFEST
|
/MANIFEST
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
downloads/
|
downloads/
|
||||||
eggs/
|
eggs/
|
||||||
@@ -204,3 +204,9 @@ hypothesis/
|
|||||||
|
|
||||||
profile.ps1
|
profile.ps1
|
||||||
.mcp.json
|
.mcp.json
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Local wiki clone (not version controlled)
|
||||||
|
# ============================================================
|
||||||
|
wiki/
|
||||||
|
docs/
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ contact_links:
|
|||||||
url: https://mokoconsulting.tech/
|
url: https://mokoconsulting.tech/
|
||||||
about: Get help or ask questions through our website
|
about: Get help or ask questions through our website
|
||||||
- name: 📚 MokoStandards Documentation
|
- name: 📚 MokoStandards Documentation
|
||||||
url: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
url: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
about: View our coding standards and best practices
|
about: View our coding standards and best practices
|
||||||
- name: 🔒 Report a Security Vulnerability
|
- name: 🔒 Report a Security Vulnerability
|
||||||
url: https://git.mokoconsulting.tech/mokoconsulting-tech/.github-private/security/advisories/new
|
url: https://git.mokoconsulting.tech/MokoConsulting/.github-private/security/advisories/new
|
||||||
about: Report security vulnerabilities privately (for critical issues)
|
about: Report security vulnerabilities privately (for critical issues)
|
||||||
- name: 💡 Community Discussions
|
- name: 💡 Community Discussions
|
||||||
url: https://github.com/orgs/mokoconsulting-tech/discussions
|
url: https://github.com/orgs/mokoconsulting-tech/discussions
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: moko-platform.Automation
|
# INGROUP: mokocli.Automation
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
# PATH: /.gitea/workflows/branch-protection.yml
|
# PATH: /.gitea/workflows/branch-protection.yml
|
||||||
# BRIEF: Apply standardised branch protection rules to all governed repositories
|
# BRIEF: Apply standardised branch protection rules to all governed repositories
|
||||||
#
|
#
|
||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
API="${GITEA_URL}/api/v1"
|
API="${GITEA_URL}/api/v1"
|
||||||
|
|
||||||
# Platform/standards/infra repos to exclude
|
# Platform/standards/infra repos to exclude
|
||||||
EXCLUDE="gitea-org-config org-profile gitea-private .mokogitea-private MokoStandards moko-platform MokoTesting"
|
EXCLUDE="gitea-org-config org-profile gitea-private .mokogitea-private MokoStandards mokocli MokoTesting"
|
||||||
EXCLUDE="$EXCLUDE MokoStandards-Template-Client MokoStandards-Template-Dolibarr MokoStandards-Template-Generic MokoStandards-Template-Joomla MokoDoliProjTemplate"
|
EXCLUDE="$EXCLUDE MokoStandards-Template-Client MokoStandards-Template-Dolibarr MokoStandards-Template-Generic MokoStandards-Template-Joomla MokoDoliProjTemplate"
|
||||||
|
|
||||||
if [ -n "${{ inputs.repos }}" ]; then
|
if [ -n "${{ inputs.repos }}" ]; then
|
||||||
@@ -124,7 +124,8 @@ jobs:
|
|||||||
"rule_name": "main",
|
"rule_name": "main",
|
||||||
"enable_push": true,
|
"enable_push": true,
|
||||||
"enable_push_whitelist": true,
|
"enable_push_whitelist": true,
|
||||||
"push_whitelist_usernames": ["jmiller"],
|
"push_whitelist_usernames": ["jmiller", "moko-deploy"],
|
||||||
|
"push_whitelist_actions_user": true,
|
||||||
"enable_force_push": false,
|
"enable_force_push": false,
|
||||||
"enable_force_push_allowlist": false,
|
"enable_force_push_allowlist": false,
|
||||||
"force_push_allowlist_usernames": [],
|
"force_push_allowlist_usernames": [],
|
||||||
@@ -140,10 +141,12 @@ jobs:
|
|||||||
"rule_name": "dev",
|
"rule_name": "dev",
|
||||||
"enable_push": true,
|
"enable_push": true,
|
||||||
"enable_push_whitelist": true,
|
"enable_push_whitelist": true,
|
||||||
"push_whitelist_usernames": ["jmiller"],
|
"push_whitelist_usernames": ["jmiller", "moko-deploy"],
|
||||||
"enable_force_push": false,
|
"push_whitelist_actions_user": true,
|
||||||
"enable_force_push_allowlist": false,
|
"enable_force_push": true,
|
||||||
"force_push_allowlist_usernames": [],
|
"enable_force_push_allowlist": true,
|
||||||
|
"force_push_allowlist_usernames": ["jmiller", "moko-deploy"],
|
||||||
|
"force_push_allowlist_actions_user": true,
|
||||||
"enable_merge_whitelist": false,
|
"enable_merge_whitelist": false,
|
||||||
"required_approvals": 0,
|
"required_approvals": 0,
|
||||||
"block_on_rejected_reviews": false,
|
"block_on_rejected_reviews": false,
|
||||||
@@ -154,10 +157,12 @@ jobs:
|
|||||||
"rule_name": "rc",
|
"rule_name": "rc",
|
||||||
"enable_push": true,
|
"enable_push": true,
|
||||||
"enable_push_whitelist": true,
|
"enable_push_whitelist": true,
|
||||||
"push_whitelist_usernames": ["jmiller"],
|
"push_whitelist_usernames": ["jmiller", "moko-deploy"],
|
||||||
"enable_force_push": false,
|
"push_whitelist_actions_user": true,
|
||||||
"enable_force_push_allowlist": false,
|
"enable_force_push": true,
|
||||||
"force_push_allowlist_usernames": [],
|
"enable_force_push_allowlist": true,
|
||||||
|
"force_push_allowlist_usernames": ["jmiller", "moko-deploy"],
|
||||||
|
"force_push_allowlist_actions_user": true,
|
||||||
"enable_merge_whitelist": false,
|
"enable_merge_whitelist": false,
|
||||||
"required_approvals": 0,
|
"required_approvals": 0,
|
||||||
"block_on_rejected_reviews": false,
|
"block_on_rejected_reviews": false,
|
||||||
@@ -168,7 +173,8 @@ jobs:
|
|||||||
"rule_name": "beta",
|
"rule_name": "beta",
|
||||||
"enable_push": true,
|
"enable_push": true,
|
||||||
"enable_push_whitelist": true,
|
"enable_push_whitelist": true,
|
||||||
"push_whitelist_usernames": ["jmiller"],
|
"push_whitelist_usernames": ["jmiller", "moko-deploy"],
|
||||||
|
"push_whitelist_actions_user": true,
|
||||||
"enable_force_push": false,
|
"enable_force_push": false,
|
||||||
"enable_force_push_allowlist": false,
|
"enable_force_push_allowlist": false,
|
||||||
"force_push_allowlist_usernames": [],
|
"force_push_allowlist_usernames": [],
|
||||||
@@ -182,7 +188,8 @@ jobs:
|
|||||||
"rule_name": "alpha",
|
"rule_name": "alpha",
|
||||||
"enable_push": true,
|
"enable_push": true,
|
||||||
"enable_push_whitelist": true,
|
"enable_push_whitelist": true,
|
||||||
"push_whitelist_usernames": ["jmiller"],
|
"push_whitelist_usernames": ["jmiller", "moko-deploy"],
|
||||||
|
"push_whitelist_actions_user": true,
|
||||||
"enable_force_push": false,
|
"enable_force_push": false,
|
||||||
"enable_force_push_allowlist": false,
|
"enable_force_push_allowlist": false,
|
||||||
"force_push_allowlist_usernames": [],
|
"force_push_allowlist_usernames": [],
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
MokoStandards Repository Manifest
|
|
||||||
Template: Joomla Extension
|
|
||||||
See: https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home
|
|
||||||
-->
|
|
||||||
<moko-platform xmlns="https://standards.mokoconsulting.tech/moko-platform/1.0" schema-version="1.0">
|
|
||||||
<identity>
|
|
||||||
<name>Template-Joomla</name>
|
|
||||||
<org>MokoConsulting</org>
|
|
||||||
<description>Template repository for Joomla extensions (plugins, modules, components, templates)</description>
|
|
||||||
<version>01.01.00</version>
|
|
||||||
<license spdx="GPL-3.0-or-later">GNU General Public License v3</license>
|
|
||||||
</identity>
|
|
||||||
<governance>
|
|
||||||
<platform>joomla</platform>
|
|
||||||
<standards-version>05.00.00</standards-version>
|
|
||||||
<standards-source>https://git.mokoconsulting.tech/MokoConsulting/moko-platform</standards-source>
|
|
||||||
</governance>
|
|
||||||
<build>
|
|
||||||
<language>PHP</language>
|
|
||||||
<package-type>joomla-extension</package-type>
|
|
||||||
<entry-point>src/</entry-point>
|
|
||||||
</build>
|
|
||||||
</moko-platform>
|
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: moko-platform.Release
|
# INGROUP: mokocli.Release
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
# PATH: /.mokogitea/workflows/auto-bump.yml
|
# PATH: /.mokogitea/workflows/auto-bump.yml
|
||||||
# VERSION: 09.02.00
|
# VERSION: 09.02.00
|
||||||
# BRIEF: Auto patch-bump version on every push to dev (skips merge commits)
|
# BRIEF: Auto patch-bump version on every push to dev (skips merge commits)
|
||||||
@@ -15,13 +15,14 @@ name: "Universal: Auto Version Bump"
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
- dev
|
||||||
- rc
|
- rc
|
||||||
- 'feature/**'
|
- 'feature/**'
|
||||||
- 'patch/**'
|
- 'patch/**'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -42,19 +43,19 @@ jobs:
|
|||||||
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Setup moko-platform tools
|
- name: Setup mokocli tools
|
||||||
run: |
|
run: |
|
||||||
if ! command -v composer &> /dev/null; then
|
if ! command -v composer &> /dev/null; then
|
||||||
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer >/dev/null 2>&1
|
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
if [ -d "/opt/moko-platform/cli" ]; then
|
if [ -d "/opt/mokocli/cli" ]; then
|
||||||
echo "MOKO_CLI=/opt/moko-platform/cli" >> "$GITHUB_ENV"
|
echo "MOKO_CLI=/opt/mokocli/cli" >> "$GITHUB_ENV"
|
||||||
else
|
else
|
||||||
git clone --depth 1 --branch main --quiet \
|
git clone --depth 1 --branch main --quiet \
|
||||||
"https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/MokoConsulting/moko-platform.git" \
|
"https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/MokoConsulting/MokoCLI.git" \
|
||||||
/tmp/moko-platform-api
|
/tmp/mokocli
|
||||||
cd /tmp/moko-platform-api && composer install --no-dev --no-interaction --quiet
|
cd /tmp/mokocli && composer install --no-dev --no-interaction --quiet
|
||||||
echo "MOKO_CLI=/tmp/moko-platform-api/cli" >> "$GITHUB_ENV"
|
echo "MOKO_CLI=/tmp/mokocli/cli" >> "$GITHUB_ENV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
|
|||||||
@@ -4,15 +4,15 @@
|
|||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: moko-platform.Release
|
# INGROUP: mokocli.Release
|
||||||
# REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/moko-platform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
# PATH: /templates/workflows/universal/auto-release.yml.template
|
# PATH: /templates/workflows/universal/auto-release.yml.template
|
||||||
# VERSION: 05.00.00
|
# VERSION: 05.01.00
|
||||||
# BRIEF: Universal build & release � detects platform from manifest.xml
|
# BRIEF: Universal build & release � detects platform from manifest.xml
|
||||||
#
|
#
|
||||||
# +========================================================================+
|
# +=======================================================================+
|
||||||
# | UNIVERSAL BUILD & RELEASE PIPELINE |
|
# | UNIVERSAL BUILD & RELEASE PIPELINE |
|
||||||
# +========================================================================+
|
# +=======================================================================+
|
||||||
# | |
|
# | |
|
||||||
# | Reads manifest.xml (joomla|dolibarr|generic) to branch logic. |
|
# | Reads manifest.xml (joomla|dolibarr|generic) to branch logic. |
|
||||||
# | |
|
# | |
|
||||||
@@ -21,15 +21,24 @@
|
|||||||
# | dolibarr: mod*.class.php, update.txt, dev version reset |
|
# | dolibarr: mod*.class.php, update.txt, dev version reset |
|
||||||
# | generic: README-only, no update stream |
|
# | generic: README-only, no update stream |
|
||||||
# | |
|
# | |
|
||||||
# +========================================================================+
|
# +=======================================================================+
|
||||||
|
|
||||||
name: "Universal: Build & Release"
|
name: "Universal: Build & Release"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, closed]
|
types: [opened, synchronize, closed]
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '.mokogitea/workflows/**'
|
||||||
|
- '*.md'
|
||||||
|
- 'wiki/**'
|
||||||
|
- '.editorconfig'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.gitattributes'
|
||||||
|
- '.gitmessage'
|
||||||
|
- 'LICENSE'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
action:
|
action:
|
||||||
@@ -43,7 +52,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
GITEA_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
|
GITEA_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
|
||||||
GITEA_REPO: ${{ vars.GITEA_REPO || github.event.repository.name }}
|
GITEA_REPO: ${{ vars.GITEA_REPO || github.event.repository.name }}
|
||||||
|
|
||||||
@@ -51,13 +60,18 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ── PR Opened → Rename branch to RC and build RC release ─────────────────────
|
# ── PR Opened → Rename branch to RC and build RC release ─────────────────────────
|
||||||
promote-rc:
|
promote-rc:
|
||||||
name: Promote to RC
|
name: Promote to RC
|
||||||
runs-on: release
|
runs-on: release
|
||||||
|
# Skip on template repos (Template-*) — they scaffold other repos and do not release.
|
||||||
if: >-
|
if: >-
|
||||||
(github.event.action == 'opened' && github.event.pull_request.merged != true) ||
|
!startsWith(github.event.repository.name, 'Template-') &&
|
||||||
(github.event_name == 'workflow_dispatch' && inputs.action == 'promote-rc')
|
(
|
||||||
|
(github.event.action == 'opened' && github.event.pull_request.merged != true) ||
|
||||||
|
(github.event.action == 'synchronize' && github.event.pull_request.merged != true) ||
|
||||||
|
(github.event_name == 'workflow_dispatch' && inputs.action == 'promote-rc')
|
||||||
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -65,26 +79,27 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup moko-platform tools
|
- name: Setup mokocli tools
|
||||||
env:
|
env:
|
||||||
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
MOKO_CLONE_HOST: git.mokoconsulting.tech/MokoConsulting
|
MOKO_CLONE_HOST: git.mokoconsulting.tech/MokoConsulting
|
||||||
run: |
|
run: |
|
||||||
if [ -f /opt/moko-platform/cli/version_bump.php ] && [ -f /opt/moko-platform/vendor/autoload.php ]; then
|
if [ -f /opt/mokocli/cli/version_bump.php ] && [ -f /opt/mokocli/vendor/autoload.php ]; then
|
||||||
echo Using pre-installed /opt/moko-platform
|
echo Using pre-installed /opt/mokocli
|
||||||
echo MOKO_CLI=/opt/moko-platform/cli >> $GITHUB_ENV
|
echo MOKO_CLI=/opt/mokocli/cli >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
echo Falling back to fresh clone
|
echo Falling back to fresh clone
|
||||||
if ! command -v composer > /dev/null 2>&1; then
|
if ! command -v composer > /dev/null 2>&1; then
|
||||||
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
|
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
rm -rf /tmp/moko-platform-api
|
rm -rf /tmp/mokocli
|
||||||
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/moko-platform.git
|
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoCLI.git
|
||||||
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/moko-platform-api
|
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli
|
||||||
cd /tmp/moko-platform-api
|
cd /tmp/mokocli
|
||||||
composer install --no-dev --no-interaction --quiet
|
composer install --no-dev --no-interaction --quiet
|
||||||
echo MOKO_CLI=/tmp/moko-platform-api/cli >> $GITHUB_ENV
|
echo MOKO_CLI=/tmp/mokocli/cli >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Rename branch to rc
|
- name: Rename branch to rc
|
||||||
@@ -92,7 +107,7 @@ jobs:
|
|||||||
php ${MOKO_CLI}/branch_rename.php \
|
php ${MOKO_CLI}/branch_rename.php \
|
||||||
--from "${{ github.event.pull_request.head.ref || 'dev' }}" --to rc \
|
--from "${{ github.event.pull_request.head.ref || 'dev' }}" --to rc \
|
||||||
--token "${{ secrets.MOKOGITEA_TOKEN }}" \
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" \
|
||||||
--api-base "${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}" \
|
--api-base "${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}" \
|
||||||
--pr "${{ github.event.pull_request.number }}"
|
--pr "${{ github.event.pull_request.number }}"
|
||||||
|
|
||||||
- name: Checkout rc and configure git
|
- name: Checkout rc and configure git
|
||||||
@@ -111,17 +126,20 @@ jobs:
|
|||||||
|
|
||||||
- name: Update RC release notes from CHANGELOG.md
|
- name: Update RC release notes from CHANGELOG.md
|
||||||
run: |
|
run: |
|
||||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
|
||||||
|
# Extract [Unreleased] section from changelog
|
||||||
|
NOTES=""
|
||||||
if [ -f "CHANGELOG.md" ]; then
|
if [ -f "CHANGELOG.md" ]; then
|
||||||
NOTES=$(awk '/^## \[Unreleased\]/{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md)
|
NOTES=$(awk '/^## \[Unreleased\]/{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md)
|
||||||
[ -z "$NOTES" ] && NOTES="Release candidate"
|
|
||||||
else
|
|
||||||
NOTES="Release candidate"
|
|
||||||
fi
|
fi
|
||||||
|
[ -z "$NOTES" ] && NOTES="Release candidate"
|
||||||
|
|
||||||
RELEASE_ID=$(curl -sf -H "Authorization: token ${{ secrets.MOKOGITEA_TOKEN }}" \
|
# Find the RC release and update its body
|
||||||
"${API_BASE}/releases/tags/release-candidate" | python3 -c "import json,sys; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
RELEASE_ID=$(curl -sf -H "Authorization: token ${TOKEN}" \
|
||||||
|
"${API_BASE}/releases/tags/release-candidate" \
|
||||||
|
| python3 -c "import json,sys; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
||||||
|
|
||||||
if [ -n "$RELEASE_ID" ]; then
|
if [ -n "$RELEASE_ID" ]; then
|
||||||
python3 -c "
|
python3 -c "
|
||||||
@@ -132,7 +150,7 @@ jobs:
|
|||||||
'${API_BASE}/releases/${RELEASE_ID}',
|
'${API_BASE}/releases/${RELEASE_ID}',
|
||||||
data=payload, method='PATCH',
|
data=payload, method='PATCH',
|
||||||
headers={
|
headers={
|
||||||
'Authorization': 'token ${{ secrets.MOKOGITEA_TOKEN }}',
|
'Authorization': 'token ${TOKEN}',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
})
|
})
|
||||||
urllib.request.urlopen(req)
|
urllib.request.urlopen(req)
|
||||||
@@ -145,3 +163,307 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "## Promoted to Release Candidate" >> $GITHUB_STEP_SUMMARY
|
echo "## Promoted to Release Candidate" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "Branch renamed to rc, minor bump, RC release built" >> $GITHUB_STEP_SUMMARY
|
echo "Branch renamed to rc, minor bump, RC release built" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
# ── Merged PR → Build & Release (or promote RC to stable) ─────────────────────────
|
||||||
|
release:
|
||||||
|
name: Build & Release Pipeline
|
||||||
|
runs-on: release
|
||||||
|
# Skip on template repos (Template-*) — they scaffold other repos and do not release.
|
||||||
|
if: >-
|
||||||
|
!startsWith(github.event.repository.name, 'Template-') &&
|
||||||
|
(
|
||||||
|
github.event.pull_request.merged == true ||
|
||||||
|
(github.event_name == 'workflow_dispatch' && inputs.action != 'promote-rc')
|
||||||
|
)
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Configure git for bot pushes
|
||||||
|
run: |
|
||||||
|
git config --local user.email "gitea-actions[bot]@mokoconsulting.tech"
|
||||||
|
git config --local user.name "gitea-actions[bot]"
|
||||||
|
git remote set-url origin "https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/${{ github.repository }}.git"
|
||||||
|
|
||||||
|
- name: Check for merge conflict markers
|
||||||
|
run: |
|
||||||
|
CONFLICTS=$(grep -rn '<<<<<<< \|>>>>>>> \|^=======$' --include='*.php' --include='*.xml' --include='*.css' --include='*.js' --include='*.json' --include='*.md' --include='*.yml' --include='*.yaml' --include='*.ini' --include='*.txt' . 2>/dev/null | grep -v '.git/' || true)
|
||||||
|
if [ -n "$CONFLICTS" ]; then
|
||||||
|
echo "::error::Merge conflict markers found — aborting release"
|
||||||
|
echo "## Release Blocked: Conflict Markers" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "$CONFLICTS" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "No conflict markers found"
|
||||||
|
|
||||||
|
- name: Setup mokocli tools
|
||||||
|
env:
|
||||||
|
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
MOKO_CLONE_HOST: git.mokoconsulting.tech/MokoConsulting
|
||||||
|
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_MIRROR_TOKEN }}"}}'
|
||||||
|
run: |
|
||||||
|
if [ -f /opt/mokocli/cli/version_bump.php ] && [ -f /opt/mokocli/vendor/autoload.php ]; then
|
||||||
|
echo Using pre-installed /opt/mokocli
|
||||||
|
echo MOKO_CLI=/opt/mokocli/cli >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo Falling back to fresh clone
|
||||||
|
if ! command -v composer > /dev/null 2>&1; then
|
||||||
|
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
rm -rf /tmp/mokocli
|
||||||
|
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoCLI.git
|
||||||
|
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli
|
||||||
|
cd /tmp/mokocli
|
||||||
|
composer install --no-dev --no-interaction --quiet
|
||||||
|
echo MOKO_CLI=/tmp/mokocli/cli >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: "Detect platform"
|
||||||
|
id: platform
|
||||||
|
run: |
|
||||||
|
php ${MOKO_CLI}/platform_detect.php --path . --github-output 2>/dev/null || true
|
||||||
|
php ${MOKO_CLI}/manifest_read.php --path . --github-output 2>/dev/null || true
|
||||||
|
|
||||||
|
- name: "Determine version bump level"
|
||||||
|
id: bump
|
||||||
|
run: |
|
||||||
|
# Fix/patch branches: version was already bumped by pre-release, just strip suffix
|
||||||
|
# Feature/dev branches: bump minor for the new stable release
|
||||||
|
HEAD_REF="${{ github.event.pull_request.head.ref || 'dev' }}"
|
||||||
|
case "$HEAD_REF" in
|
||||||
|
fix/*|patch/*|hotfix/*|bugfix/*) BUMP="none" ;;
|
||||||
|
*) BUMP="minor" ;;
|
||||||
|
esac
|
||||||
|
echo "level=${BUMP}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Bump level: ${BUMP} (from branch: ${HEAD_REF})"
|
||||||
|
|
||||||
|
- name: "Publish stable release"
|
||||||
|
run: |
|
||||||
|
BUMP_FLAG=""
|
||||||
|
if [ "${{ steps.bump.outputs.level }}" != "none" ]; then
|
||||||
|
BUMP_FLAG="--bump ${{ steps.bump.outputs.level }}"
|
||||||
|
fi
|
||||||
|
php ${MOKO_CLI}/release_publish.php \
|
||||||
|
--path . --stability stable ${BUMP_FLAG} --branch main \
|
||||||
|
--token "${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
|
||||||
|
- name: "Read published version"
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION=$(php ${MOKO_CLI}/version_read.php --path . 2>/dev/null || echo "")
|
||||||
|
VERSION=$(echo "$VERSION" | sed 's/-\(dev\|alpha\|beta\|rc\)$//')
|
||||||
|
[ -z "$VERSION" ] && VERSION="00.00.00" && echo "skip=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
PLATFORM="${{ steps.platform.outputs.platform }}"
|
||||||
|
if [[ "$PLATFORM" == joomla* ]]; then
|
||||||
|
echo "tag=stable" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "release_tag=stable" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "tag=v${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "release_tag=v${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
echo "branch=main" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Published version: ${VERSION}"
|
||||||
|
|
||||||
|
- name: "Create semver tag for non-Joomla repos"
|
||||||
|
id: semver
|
||||||
|
if: |
|
||||||
|
steps.version.outputs.skip != 'true' &&
|
||||||
|
!startsWith(steps.platform.outputs.platform, 'joomla')
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.version.outputs.version }}"
|
||||||
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
SEMVER_TAG="v${VERSION}"
|
||||||
|
|
||||||
|
echo "Creating semver tag: ${SEMVER_TAG}"
|
||||||
|
|
||||||
|
# Create the git tag via API
|
||||||
|
HTTP_CODE=$(curl -sf -o /dev/null -w "%{http_code}" \
|
||||||
|
-X POST -H "Authorization: token ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${API_BASE}/tags" \
|
||||||
|
-d "{\"tag_name\":\"${SEMVER_TAG}\",\"target\":\"main\",\"message\":\"Release ${VERSION}\"}" 2>/dev/null || echo "000")
|
||||||
|
|
||||||
|
if [ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "200" ]; then
|
||||||
|
echo "Created semver tag: ${SEMVER_TAG}"
|
||||||
|
elif [ "$HTTP_CODE" = "409" ]; then
|
||||||
|
echo "Semver tag ${SEMVER_TAG} already exists (skipped)"
|
||||||
|
else
|
||||||
|
echo "::warning::Failed to create semver tag ${SEMVER_TAG} (HTTP ${HTTP_CODE})"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "semver_tag=${SEMVER_TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Update release notes and promote changelog
|
||||||
|
run: |
|
||||||
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
|
||||||
|
# Get the stable release info (version and ID)
|
||||||
|
RELEASE_JSON=$(curl -sf -H "Authorization: token ${TOKEN}" \
|
||||||
|
"${API_BASE}/releases/tags/stable" 2>/dev/null || echo '{}')
|
||||||
|
RELEASE_ID=$(python3 -c "import json,sys; print(json.load(sys.stdin).get('id',''))" <<< "$RELEASE_JSON" 2>/dev/null || true)
|
||||||
|
# Extract version from release name (e.g. "06.17.00" or "v06.17.00")
|
||||||
|
VERSION=$(python3 -c "
|
||||||
|
import json, sys, re
|
||||||
|
r = json.load(sys.stdin)
|
||||||
|
name = r.get('name', '')
|
||||||
|
m = re.search(r'(\d+\.\d+\.\d+)', name)
|
||||||
|
print(m.group(1) if m else '')
|
||||||
|
" <<< "$RELEASE_JSON" 2>/dev/null || true)
|
||||||
|
|
||||||
|
# Extract [Unreleased] section from changelog
|
||||||
|
NOTES=""
|
||||||
|
if [ -f "CHANGELOG.md" ]; then
|
||||||
|
NOTES=$(awk '/^## \[Unreleased\]/{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md)
|
||||||
|
fi
|
||||||
|
[ -z "$NOTES" ] && NOTES="Stable release"
|
||||||
|
|
||||||
|
# Update release body via API
|
||||||
|
if [ -n "$RELEASE_ID" ]; then
|
||||||
|
python3 -c "
|
||||||
|
import json, urllib.request
|
||||||
|
body = open('/dev/stdin').read()
|
||||||
|
payload = json.dumps({'body': body}).encode()
|
||||||
|
req = urllib.request.Request(
|
||||||
|
'${API_BASE}/releases/${RELEASE_ID}',
|
||||||
|
data=payload, method='PATCH',
|
||||||
|
headers={
|
||||||
|
'Authorization': 'token ${TOKEN}',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
})
|
||||||
|
urllib.request.urlopen(req)
|
||||||
|
" <<< "$NOTES"
|
||||||
|
echo "Release notes updated from CHANGELOG.md"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Promote [Unreleased] → [version] in CHANGELOG.md and reset
|
||||||
|
if [ -n "$VERSION" ] && [ -f "CHANGELOG.md" ]; then
|
||||||
|
DATE=$(date +%Y-%m-%d)
|
||||||
|
python3 -c "
|
||||||
|
import sys
|
||||||
|
version, date = sys.argv[1], sys.argv[2]
|
||||||
|
content = open('CHANGELOG.md').read()
|
||||||
|
old = '## [Unreleased]'
|
||||||
|
new = f'## [Unreleased]\n\n## [{version}] --- {date}'
|
||||||
|
content = content.replace(old, new, 1)
|
||||||
|
open('CHANGELOG.md', 'w').write(content)
|
||||||
|
" "$VERSION" "$DATE"
|
||||||
|
git add CHANGELOG.md
|
||||||
|
git commit -m "chore: promote changelog [Unreleased] → [${VERSION}]" || true
|
||||||
|
git push origin main || true
|
||||||
|
echo "Changelog promoted: [Unreleased] → [${VERSION}]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -- STEP 9: Mirror to GitHub (stable only) --------------------------------
|
||||||
|
- name: "Step 9: Mirror release to GitHub"
|
||||||
|
if: >-
|
||||||
|
steps.version.outputs.skip != 'true' &&
|
||||||
|
secrets.GH_MIRROR_TOKEN != ''
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.bump.outputs.version || steps.version.outputs.version }}"
|
||||||
|
RELEASE_TAG="${{ steps.version.outputs.release_tag }}"
|
||||||
|
GH_REPO="${{ vars.GH_MIRROR_REPO || github.repository }}"
|
||||||
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
php ${MOKO_CLI}/release_mirror.php \
|
||||||
|
--version "$VERSION" --tag "$RELEASE_TAG" \
|
||||||
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "$API_BASE" \
|
||||||
|
--gh-token "${{ secrets.GH_MIRROR_TOKEN }}" --gh-repo "$GH_REPO" \
|
||||||
|
--branch main 2>&1 || true
|
||||||
|
echo "GitHub mirror updated" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
# -- STEP 10: Sync main branch to GitHub mirror ----------------------------
|
||||||
|
- name: "Step 10: Push main to GitHub mirror"
|
||||||
|
if: >-
|
||||||
|
steps.version.outputs.skip != 'true' &&
|
||||||
|
secrets.GH_MIRROR_TOKEN != ''
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
GH_REPO="${{ vars.GH_MIRROR_REPO || github.repository }}"
|
||||||
|
GH_ORG=$(echo "$GH_REPO" | cut -d/ -f1)
|
||||||
|
GH_NAME=$(echo "$GH_REPO" | cut -d/ -f2)
|
||||||
|
git remote add github "https://x-access-token:${{ secrets.GH_MIRROR_TOKEN }}@github.com/${GH_ORG}/${GH_NAME}.git" 2>/dev/null || \
|
||||||
|
git remote set-url github "https://x-access-token:${{ secrets.GH_MIRROR_TOKEN }}@github.com/${GH_ORG}/${GH_NAME}.git"
|
||||||
|
git fetch origin main --depth=1
|
||||||
|
git push github origin/main:refs/heads/main --force 2>/dev/null \
|
||||||
|
&& echo "main branch pushed to GitHub mirror" \
|
||||||
|
|| echo "WARNING: GitHub mirror push failed"
|
||||||
|
|
||||||
|
- name: "Step 11: Delete rc branch (dev reset moved to cascade-dev.yml)"
|
||||||
|
if: steps.version.outputs.skip != 'true'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
|
||||||
|
# Delete rc branch (ephemeral — created by promote-rc)
|
||||||
|
curl -sf -X DELETE -H "Authorization: token ${TOKEN}" \
|
||||||
|
"${API_BASE}/branches/rc" 2>/dev/null \
|
||||||
|
&& echo "Deleted rc branch" || echo "rc branch not found"
|
||||||
|
|
||||||
|
# dev is reset from main by the dedicated "Cascade Main -> Dev" workflow
|
||||||
|
# (cascade-dev.yml), which runs after this release completes.
|
||||||
|
echo "rc cleaned; dev reset handled by cascade-dev.yml" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
- name: "Step 12: Create version branch from main"
|
||||||
|
if: steps.version.outputs.skip != 'true'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
VERSION="${{ steps.bump.outputs.version || steps.version.outputs.version }}"
|
||||||
|
BRANCH_NAME="version/${VERSION}"
|
||||||
|
MAIN_SHA=$(git rev-parse HEAD)
|
||||||
|
|
||||||
|
# Delete old version branch if it exists (same version re-release)
|
||||||
|
curl -sf -X DELETE -H "Authorization: token ${TOKEN}" "${API_BASE}/branches/${BRANCH_NAME}" 2>/dev/null && echo "Deleted old ${BRANCH_NAME}"
|
||||||
|
|
||||||
|
# Create version/XX.YY.ZZ from main
|
||||||
|
curl -sf -X POST -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "${API_BASE}/branches" -d "{\"new_branch_name\":\"${BRANCH_NAME}\",\"old_branch_name\":\"main\"}" 2>/dev/null && echo "Created ${BRANCH_NAME} from main (${MAIN_SHA})" || echo "WARNING: ${BRANCH_NAME} creation failed"
|
||||||
|
|
||||||
|
echo "Version branch created: ${BRANCH_NAME} (${MAIN_SHA})" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# -- Dolibarr post-release: Reset dev version -----------------------------
|
||||||
|
- name: "Post-release: Reset dev version"
|
||||||
|
if: steps.version.outputs.skip != 'true'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
php ${MOKO_CLI}/version_reset_dev.php \
|
||||||
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "${API_BASE}" \
|
||||||
|
--branch dev --path . 2>&1 || true
|
||||||
|
|
||||||
|
# -- Summary --------------------------------------------------------------
|
||||||
|
- name: Pipeline Summary
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.bump.outputs.version || steps.version.outputs.version }}"
|
||||||
|
PLATFORM="${{ steps.platform.outputs.platform }}"
|
||||||
|
if [ "${{ steps.version.outputs.skip }}" = "true" ]; then
|
||||||
|
echo "## Release Skipped" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "No VERSION in README.md" >> $GITHUB_STEP_SUMMARY
|
||||||
|
elif [ "${{ steps.check.outputs.already_released }}" = "true" ]; then
|
||||||
|
echo "## Already Released — ${VERSION}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
else
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "## Build & Release Complete (${PLATFORM})" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Step | Result |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Platform | \`${PLATFORM}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Version | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Branch | \`${{ steps.version.outputs.branch }}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Tag | \`${{ steps.version.outputs.tag }}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Release | [View](${MOKOGITEA_URL}/${GITEA_ORG}/${GITEA_REPO}/releases/tag/${{ steps.version.outputs.tag }}) |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
fi
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: MokoStandards.Universal
|
# INGROUP: MokoStandards.Universal
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
# PATH: /.mokogitea/workflows/branch-cleanup.yml
|
# PATH: /.mokogitea/workflows/branch-cleanup.yml
|
||||||
# VERSION: 01.00.00
|
# VERSION: 01.00.00
|
||||||
# BRIEF: Delete feature branches after PR merge
|
# BRIEF: Delete feature branches after PR merge
|
||||||
@@ -33,7 +33,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
BRANCH="${{ github.event.pull_request.head.ref }}"
|
BRANCH="${{ github.event.pull_request.head.ref }}"
|
||||||
API="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}/api/v1/repos/${{ github.repository }}/branches"
|
API="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}/api/v1/repos/${{ github.repository }}/branches"
|
||||||
ENCODED=$(php -r "echo rawurlencode('${BRANCH}');")
|
# URL-encode the branch name's slashes (no PHP dependency on the runner)
|
||||||
|
ENCODED=$(printf '%s' "${BRANCH}" | sed 's|/|%2F|g')
|
||||||
|
|
||||||
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X DELETE \
|
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X DELETE \
|
||||||
-H "Authorization: token ${{ secrets.MOKOGITEA_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.MOKOGITEA_TOKEN }}" \
|
||||||
|
|||||||
@@ -1,10 +1,65 @@
|
|||||||
# DISABLED — auto-release Step 11 recreates dev from main after every release.
|
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
# Cascade-dev is redundant and causes version conflicts when both main and dev
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
# have different version numbers in templateDetails.xml / manifest.xml.
|
# FILE INFORMATION
|
||||||
name: "Cascade Main → Dev (DISABLED)"
|
# DEFGROUP: Gitea.Workflow
|
||||||
on: workflow_dispatch
|
# INGROUP: mokocli.Release
|
||||||
|
# BRIEF: Reset dev to main after each release (cascade). Moved out of auto-release Step 11.
|
||||||
|
#
|
||||||
|
# +========================================================================+
|
||||||
|
# | CASCADE MAIN -> DEV |
|
||||||
|
# +========================================================================+
|
||||||
|
# | dev mirrors main and is reset on every release. |
|
||||||
|
# | delete+recreate cannot run against a protected branch, so this |
|
||||||
|
# | force-pushes main -> dev. The automation identity is force-push |
|
||||||
|
# | allowlisted on dev via branch-protection.yml. |
|
||||||
|
# | Runs AFTER the release workflow completes, so dev picks up the |
|
||||||
|
# | fully version-bumped + changelog-promoted main (not the pre-bump |
|
||||||
|
# | state). Force-push (not merge) => no version-file conflicts. |
|
||||||
|
# +========================================================================+
|
||||||
|
|
||||||
|
name: "Cascade Main -> Dev"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Universal: Build & Release"]
|
||||||
|
types: [completed]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: cascade-dev-${{ github.repository }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
noop:
|
cascade:
|
||||||
|
name: Reset dev to main
|
||||||
|
if: >-
|
||||||
|
!startsWith(github.event.repository.name, 'Template-') &&
|
||||||
|
(github.event_name == 'workflow_dispatch' ||
|
||||||
|
github.event.workflow_run.conclusion == 'success')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- run: echo "Cascade disabled — auto-release handles dev recreation"
|
- name: Force dev to main
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
SERVER: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
git init -q sync && cd sync
|
||||||
|
git config user.email "gitea-actions[bot]@mokoconsulting.tech"
|
||||||
|
git config user.name "gitea-actions[bot]"
|
||||||
|
git remote add origin "https://x-access-token:${TOKEN}@${SERVER#https://}/${REPO}.git"
|
||||||
|
git fetch -q --depth=1 origin main
|
||||||
|
|
||||||
|
if git ls-remote --exit-code --heads origin dev >/dev/null 2>&1; then
|
||||||
|
# dev exists -> force it to match main (dev is a mirror of main)
|
||||||
|
git push --force origin FETCH_HEAD:refs/heads/dev
|
||||||
|
echo "dev reset to main" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
else
|
||||||
|
# dev missing (e.g. renamed to rc mid-cycle) -> recreate from main
|
||||||
|
git push origin FETCH_HEAD:refs/heads/dev
|
||||||
|
echo "dev created from main" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
name: Lint & Validate
|
name: Lint & Validate
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# Skip on template repos (Template-*) — they hold placeholder scaffolding, not buildable source.
|
||||||
|
if: ${{ !startsWith(github.event.repository.name, 'Template-') }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -130,6 +132,9 @@ jobs:
|
|||||||
name: Tests
|
name: Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: lint
|
needs: lint
|
||||||
|
# Run only when lint succeeded; always() forces evaluation so a skipped
|
||||||
|
# lint (e.g. template repos) skips this job cleanly instead of hanging.
|
||||||
|
if: ${{ always() && needs.lint.result == 'success' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
|
# FILE INFORMATION
|
||||||
|
# DEFGROUP: Gitea.Workflow
|
||||||
|
# INGROUP: mokocli.Universal
|
||||||
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
|
# PATH: /.mokogitea/workflows/ci-issue-reporter.yml
|
||||||
|
# VERSION: 01.00.00
|
||||||
|
# BRIEF: Reusable workflow — creates/updates a Gitea issue when a CI gate fails.
|
||||||
|
# Clones MokoCLI and runs cli/ci_issue_reporter.sh.
|
||||||
|
|
||||||
|
name: "Universal: CI Issue Reporter"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
gate:
|
||||||
|
description: "CI gate name (e.g. PR Validation, Repository Health)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
details:
|
||||||
|
description: "Human-readable failure description"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
severity:
|
||||||
|
description: "error or warning"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "error"
|
||||||
|
workflow:
|
||||||
|
description: "Workflow name for the issue title"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
secrets:
|
||||||
|
MOKOGITEA_TOKEN:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
report:
|
||||||
|
name: "Report: ${{ inputs.gate }}"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clone MokoCLI
|
||||||
|
env:
|
||||||
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
run: |
|
||||||
|
MOKOGITEA_URL="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}"
|
||||||
|
git clone --depth 1 --filter=blob:none --sparse "${MOKOGITEA_URL}/MokoConsulting/MokoCLI.git" /tmp/mokocli
|
||||||
|
cd /tmp/mokocli && git sparse-checkout set cli/ci_issue_reporter.sh
|
||||||
|
|
||||||
|
- name: Report CI failure
|
||||||
|
env:
|
||||||
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
run: |
|
||||||
|
chmod +x /tmp/mokocli/cli/ci_issue_reporter.sh
|
||||||
|
/tmp/mokocli/cli/ci_issue_reporter.sh \
|
||||||
|
--gate "${{ inputs.gate }}" \
|
||||||
|
--details "${{ inputs.details }}" \
|
||||||
|
--severity "${{ inputs.severity }}" \
|
||||||
|
--workflow "${{ inputs.workflow }}"
|
||||||
+1302
-33
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cleanup:
|
cleanup:
|
||||||
@@ -33,30 +33,30 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.GA_TOKEN }}
|
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
|
||||||
- name: Delete merged branches
|
- name: Delete merged branches
|
||||||
env:
|
env:
|
||||||
GA_TOKEN: ${{ secrets.GA_TOKEN }}
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
echo "=== Merged Branch Cleanup ==="
|
echo "=== Merged Branch Cleanup ==="
|
||||||
API="${GITEA_URL}/api/v1/repos/${{ github.repository }}"
|
API="${MOKOGITEA_URL}/api/v1/repos/${{ github.repository }}"
|
||||||
|
|
||||||
# List branches via API
|
# List branches via API
|
||||||
BRANCHES=$(curl -sS -H "Authorization: token ${GA_TOKEN}" \
|
BRANCHES=$(curl -sS -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||||
"${API}/branches?limit=50" | jq -r '.[].name')
|
"${API}/branches?limit=50" | jq -r '.[].name')
|
||||||
|
|
||||||
DELETED=0
|
DELETED=0
|
||||||
for BRANCH in $BRANCHES; do
|
for BRANCH in $BRANCHES; do
|
||||||
# Skip protected branches
|
# Skip protected branches
|
||||||
case "$BRANCH" in
|
case "$BRANCH" in
|
||||||
main|master|develop|release/*|hotfix/*) continue ;;
|
main|master|dev|develop|rc|beta|alpha|release|release/*|production|stable|staging|hotfix/*|version/*) continue ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check if branch is merged into main
|
# Check if branch is merged into main
|
||||||
if git merge-base --is-ancestor "origin/${BRANCH}" origin/main 2>/dev/null; then
|
if git merge-base --is-ancestor "origin/${BRANCH}" origin/main 2>/dev/null; then
|
||||||
echo " Deleting merged branch: ${BRANCH}"
|
echo " Deleting merged branch: ${BRANCH}"
|
||||||
curl -sS -X DELETE -H "Authorization: token ${GA_TOKEN}" \
|
curl -sS -X DELETE -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||||
"${API}/branches/${BRANCH}" 2>/dev/null || true
|
"${API}/branches/${BRANCH}" 2>/dev/null || true
|
||||||
DELETED=$((DELETED + 1))
|
DELETED=$((DELETED + 1))
|
||||||
fi
|
fi
|
||||||
@@ -66,20 +66,20 @@ jobs:
|
|||||||
|
|
||||||
- name: Clean old workflow runs
|
- name: Clean old workflow runs
|
||||||
env:
|
env:
|
||||||
GA_TOKEN: ${{ secrets.GA_TOKEN }}
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
echo "=== Workflow Run Cleanup ==="
|
echo "=== Workflow Run Cleanup ==="
|
||||||
API="${GITEA_URL}/api/v1/repos/${{ github.repository }}"
|
API="${MOKOGITEA_URL}/api/v1/repos/${{ github.repository }}"
|
||||||
CUTOFF=$(date -d "30 days ago" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -v-30d +%Y-%m-%dT%H:%M:%SZ)
|
CUTOFF=$(date -d "30 days ago" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -v-30d +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
|
||||||
# Get old completed runs
|
# Get old completed runs
|
||||||
RUNS=$(curl -sS -H "Authorization: token ${GA_TOKEN}" \
|
RUNS=$(curl -sS -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||||
"${API}/actions/runs?status=completed&limit=50" | \
|
"${API}/actions/runs?status=completed&limit=50" | \
|
||||||
jq -r ".workflow_runs[] | select(.created_at < \"${CUTOFF}\") | .id" 2>/dev/null)
|
jq -r ".workflow_runs[] | select(.created_at < \"${CUTOFF}\") | .id" 2>/dev/null)
|
||||||
|
|
||||||
DELETED=0
|
DELETED=0
|
||||||
for RUN_ID in $RUNS; do
|
for RUN_ID in $RUNS; do
|
||||||
curl -sS -X DELETE -H "Authorization: token ${GA_TOKEN}" \
|
curl -sS -X DELETE -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||||
"${API}/actions/runs/${RUN_ID}" 2>/dev/null || true
|
"${API}/actions/runs/${RUN_ID}" 2>/dev/null || true
|
||||||
DELETED=$((DELETED + 1))
|
DELETED=$((DELETED + 1))
|
||||||
done
|
done
|
||||||
|
|||||||
+27
-12
@@ -4,15 +4,16 @@
|
|||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: MokoPlatform.Universal
|
# INGROUP: mokocli.Universal
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokoplatform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
# PATH: /.mokogitea/workflows/workflow-sync-trigger.yml
|
# PATH: /.mokogitea/workflows/workflow-sync-trigger.yml
|
||||||
# VERSION: 01.00.00
|
# VERSION: 01.01.00
|
||||||
# BRIEF: Trigger workflow sync to live repos when a PR is merged to main
|
# BRIEF: Trigger workflow sync to live repos when a PR is merged to main
|
||||||
|
|
||||||
name: "Universal: Workflow Sync Trigger"
|
name: "Universal: Workflow Sync Trigger"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [closed]
|
types: [closed]
|
||||||
branches:
|
branches:
|
||||||
@@ -26,8 +27,10 @@ jobs:
|
|||||||
name: Sync workflows to live repos
|
name: Sync workflows to live repos
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: >-
|
if: >-
|
||||||
github.event.pull_request.merged == true &&
|
startsWith(github.event.repository.name, 'Template-') &&
|
||||||
!contains(github.event.pull_request.title, '[skip sync]')
|
(github.event_name == 'workflow_dispatch' ||
|
||||||
|
(github.event.pull_request.merged == true &&
|
||||||
|
!contains(github.event.pull_request.title, '[skip sync]')))
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Determine platform from repo name
|
- name: Determine platform from repo name
|
||||||
@@ -45,16 +48,28 @@ jobs:
|
|||||||
echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT"
|
echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT"
|
||||||
echo "Platform: ${PLATFORM:-all}"
|
echo "Platform: ${PLATFORM:-all}"
|
||||||
|
|
||||||
|
- name: Clone mokocli
|
||||||
|
env:
|
||||||
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
run: |
|
||||||
|
MOKOGITEA_URL="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}"
|
||||||
|
git clone --depth 1 "${MOKOGITEA_URL}/MokoConsulting/MokoCLI.git" /tmp/mokocli
|
||||||
|
|
||||||
|
- name: Install PHP
|
||||||
|
run: |
|
||||||
|
if ! command -v php &> /dev/null; then
|
||||||
|
apt-get update -qq && apt-get install -y -qq php-cli php-json php-curl > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
cd /tmp/mokocli
|
||||||
|
composer install --no-dev --no-interaction --quiet 2>/dev/null || true
|
||||||
|
|
||||||
- name: Run workflow sync
|
- name: Run workflow sync
|
||||||
env:
|
env:
|
||||||
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
MOKOPLATFORM="/opt/mokoplatform"
|
|
||||||
if [ ! -f "${MOKOPLATFORM}/cli/workflow_sync.php" ]; then
|
|
||||||
echo "::error::mokoplatform not found at ${MOKOPLATFORM}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARGS="--token ${MOKOGITEA_TOKEN}"
|
ARGS="--token ${MOKOGITEA_TOKEN}"
|
||||||
ARGS="${ARGS} --org ${{ vars.GITEA_ORG || github.repository_owner }}"
|
ARGS="${ARGS} --org ${{ vars.GITEA_ORG || github.repository_owner }}"
|
||||||
ARGS="${ARGS} --phase repos"
|
ARGS="${ARGS} --phase repos"
|
||||||
@@ -64,4 +79,4 @@ jobs:
|
|||||||
ARGS="${ARGS} --platform-filter ${PLATFORM}"
|
ARGS="${ARGS} --platform-filter ${PLATFORM}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
php "${MOKOPLATFORM}/cli/workflow_sync.php" ${ARGS}
|
php /tmp/mokocli/cli/workflow_sync.php ${ARGS}
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
#
|
|
||||||
# FILE INFORMATION
|
|
||||||
# DEFGROUP: Gitea.Workflow
|
|
||||||
# INGROUP: MokoStandards.Deploy
|
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-API
|
|
||||||
# PATH: /templates/workflows/joomla/deploy-manual.yml.template
|
|
||||||
# VERSION: 04.07.00
|
|
||||||
# BRIEF: Manual SFTP deploy to dev server for Joomla repos
|
|
||||||
|
|
||||||
name: "Universal: Deploy to Dev (Manual)"
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
clear_remote:
|
|
||||||
description: 'Delete all remote files before uploading'
|
|
||||||
required: false
|
|
||||||
default: 'false'
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
env:
|
|
||||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
name: SFTP Deploy to Dev
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
run: |
|
|
||||||
php -v && composer --version
|
|
||||||
|
|
||||||
- name: Setup MokoStandards tools
|
|
||||||
env:
|
|
||||||
GA_TOKEN: ${{ secrets.GA_TOKEN || secrets.GA_TOKEN || github.token }}
|
|
||||||
MOKO_CLONE_TOKEN: ${{ secrets.GA_TOKEN || secrets.GA_TOKEN || github.token }}
|
|
||||||
MOKO_CLONE_HOST: ${{ secrets.GA_TOKEN && 'git.mokoconsulting.tech/MokoConsulting' || 'github.com/mokoconsulting-tech' }}
|
|
||||||
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GA_TOKEN || github.token }}"}}'
|
|
||||||
run: |
|
|
||||||
git clone --depth 1 --branch main --quiet \
|
|
||||||
"https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoStandards-API.git" \
|
|
||||||
/tmp/mokostandards-api 2>/dev/null || true
|
|
||||||
if [ -d "/tmp/mokostandards-api" ] && [ -f "/tmp/mokostandards-api/composer.json" ]; then
|
|
||||||
cd /tmp/mokostandards-api && composer install --no-dev --no-interaction --quiet 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Check FTP configuration
|
|
||||||
id: check
|
|
||||||
env:
|
|
||||||
HOST: ${{ vars.DEV_FTP_HOST }}
|
|
||||||
PATH_VAR: ${{ vars.DEV_FTP_PATH }}
|
|
||||||
PORT: ${{ vars.DEV_FTP_PORT }}
|
|
||||||
run: |
|
|
||||||
if [ -z "$HOST" ] || [ -z "$PATH_VAR" ]; then
|
|
||||||
echo "DEV_FTP_HOST or DEV_FTP_PATH not configured -- cannot deploy"
|
|
||||||
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "host=$HOST" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
REMOTE="${PATH_VAR%/}"
|
|
||||||
echo "remote=$REMOTE" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
[ -z "$PORT" ] && PORT="22"
|
|
||||||
echo "port=$PORT" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Deploy via SFTP
|
|
||||||
if: steps.check.outputs.skip != 'true'
|
|
||||||
env:
|
|
||||||
SFTP_KEY: ${{ secrets.DEV_FTP_KEY }}
|
|
||||||
SFTP_PASS: ${{ secrets.DEV_FTP_PASSWORD }}
|
|
||||||
SFTP_USER: ${{ vars.DEV_FTP_USERNAME }}
|
|
||||||
run: |
|
|
||||||
SOURCE_DIR="src"
|
|
||||||
[ ! -d "$SOURCE_DIR" ] && SOURCE_DIR="htdocs"
|
|
||||||
[ ! -d "$SOURCE_DIR" ] && { echo "No src/ or htdocs/ -- nothing to deploy"; exit 0; }
|
|
||||||
|
|
||||||
printf '{"host":"%s","port":%s,"username":"%s","remotePath":"%s"' \
|
|
||||||
"${{ steps.check.outputs.host }}" "${{ steps.check.outputs.port }}" "$SFTP_USER" "${{ steps.check.outputs.remote }}" \
|
|
||||||
> /tmp/sftp-config.json
|
|
||||||
|
|
||||||
if [ -n "$SFTP_KEY" ]; then
|
|
||||||
echo "$SFTP_KEY" > /tmp/deploy_key
|
|
||||||
chmod 600 /tmp/deploy_key
|
|
||||||
printf ',"privateKeyPath":"/tmp/deploy_key"}' >> /tmp/sftp-config.json
|
|
||||||
else
|
|
||||||
printf ',"password":"%s"}' "$SFTP_PASS" >> /tmp/sftp-config.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
DEPLOY_ARGS=(--path . --src-dir "$SOURCE_DIR" --config /tmp/sftp-config.json)
|
|
||||||
[ "${{ inputs.clear_remote }}" = "true" ] && DEPLOY_ARGS+=(--clear-remote)
|
|
||||||
|
|
||||||
PLATFORM=$(php /tmp/mokostandards-api/cli/platform_detect.php --path . 2>/dev/null || true)
|
|
||||||
if [ "$PLATFORM" = "waas-component" ] && [ -f "/tmp/mokostandards-api/deploy/deploy-joomla.php" ]; then
|
|
||||||
php /tmp/mokostandards-api/deploy/deploy-joomla.php "${DEPLOY_ARGS[@]}"
|
|
||||||
else
|
|
||||||
php /tmp/mokostandards-api/deploy/deploy-sftp.php "${DEPLOY_ARGS[@]}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f /tmp/deploy_key /tmp/sftp-config.json
|
|
||||||
|
|
||||||
- name: Summary
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
if [ "${{ steps.check.outputs.skip }}" = "true" ]; then
|
|
||||||
echo "### Deploy Skipped -- FTP not configured" >> $GITHUB_STEP_SUMMARY
|
|
||||||
else
|
|
||||||
echo "### Manual Dev Deploy Complete" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "| Host | \`${{ steps.check.outputs.host }}\` |" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "| Remote | \`${{ steps.check.outputs.remote }}\` |" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "| Clear | ${{ inputs.clear_remote }} |" >> $GITHUB_STEP_SUMMARY
|
|
||||||
fi
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: MokoStandards.Security
|
# INGROUP: MokoStandards.Security
|
||||||
# REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/MokoStandards-API
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-API
|
||||||
# PATH: /templates/workflows/gitleaks.yml.template
|
# PATH: /templates/workflows/gitleaks.yml.template
|
||||||
# VERSION: 01.00.00
|
# VERSION: 01.00.00
|
||||||
# BRIEF: Secret scanning — detect leaked credentials, API keys, and tokens
|
# BRIEF: Secret scanning — detect leaked credentials, API keys, and tokens
|
||||||
@@ -25,10 +25,6 @@
|
|||||||
name: "Universal: Secret Scanning"
|
name: "Universal: Secret Scanning"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- 'dev/**'
|
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 5 * * 1' # Weekly Monday 05:00 UTC
|
- cron: '0 5 * * 1' # Weekly Monday 05:00 UTC
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: moko-platform.Automation
|
# INGROUP: mokocli.Automation
|
||||||
# VERSION: 01.00.00
|
# VERSION: 01.00.00
|
||||||
# BRIEF: Auto-create feature branch when an issue is opened
|
# BRIEF: Auto-create feature branch when an issue is opened
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ permissions:
|
|||||||
issues: write
|
issues: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-branch:
|
create-branch:
|
||||||
@@ -28,8 +28,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Create branch and comment
|
- name: Create branch and comment
|
||||||
run: |
|
run: |
|
||||||
TOKEN="${{ secrets.GA_TOKEN }}"
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
API="${GITEA_URL}/api/v1/repos/${{ github.repository }}"
|
API="${MOKOGITEA_URL}/api/v1/repos/${{ github.repository }}"
|
||||||
ISSUE_NUM="${{ github.event.issue.number }}"
|
ISSUE_NUM="${{ github.event.issue.number }}"
|
||||||
ISSUE_TITLE="${{ github.event.issue.title }}"
|
ISSUE_TITLE="${{ github.event.issue.title }}"
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ jobs:
|
|||||||
echo "Created branch: ${BRANCH}"
|
echo "Created branch: ${BRANCH}"
|
||||||
|
|
||||||
# Comment on issue with branch link
|
# Comment on issue with branch link
|
||||||
REPO_URL="${GITEA_URL}/${{ github.repository }}"
|
REPO_URL="${MOKOGITEA_URL}/${{ github.repository }}"
|
||||||
BODY="Branch created: [\`${BRANCH}\`](${REPO_URL}/src/branch/${BRANCH})\n\n\`\`\`bash\ngit fetch origin\ngit checkout ${BRANCH}\n\`\`\`"
|
BODY="Branch created: [\`${BRANCH}\`](${REPO_URL}/src/branch/${BRANCH})\n\n\`\`\`bash\ngit fetch origin\ngit checkout ${BRANCH}\n\`\`\`"
|
||||||
|
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ name: "Universal: Notifications"
|
|||||||
on:
|
on:
|
||||||
workflow_run:
|
workflow_run:
|
||||||
workflows:
|
workflows:
|
||||||
- "Joomla Build & Release"
|
- "Universal: Build & Release"
|
||||||
- "Joomla Extension CI"
|
- "Joomla: Extension CI"
|
||||||
- "Deploy"
|
- "Generic: Project CI"
|
||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: moko-platform.CI
|
# INGROUP: mokocli.CI
|
||||||
# REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/moko-platform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
# PATH: /templates/workflows/universal/pr-check.yml.template
|
# PATH: /templates/workflows/universal/pr-check.yml.template
|
||||||
# VERSION: 09.23.00
|
# VERSION: 09.23.00
|
||||||
# BRIEF: PR gate — branch policy + code validation before merge
|
# BRIEF: PR gate — branch policy + code validation before merge
|
||||||
@@ -96,10 +96,38 @@ jobs:
|
|||||||
echo "Branch policy: OK (${HEAD} → ${BASE})"
|
echo "Branch policy: OK (${HEAD} → ${BASE})"
|
||||||
echo "## Branch Policy: Passed" >> $GITHUB_STEP_SUMMARY
|
echo "## Branch Policy: Passed" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
# ── Secret Scanning ──────────────────────────────────────────────────
|
||||||
|
gitleaks:
|
||||||
|
name: Secret Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install Gitleaks
|
||||||
|
run: |
|
||||||
|
GITLEAKS_VERSION="8.21.2"
|
||||||
|
curl -sSL "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
|
||||||
|
| tar -xz -C /usr/local/bin gitleaks
|
||||||
|
|
||||||
|
- name: Scan PR commits for secrets
|
||||||
|
run: |
|
||||||
|
if gitleaks detect --source . --verbose \
|
||||||
|
--log-opts=${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} 2>&1; then
|
||||||
|
echo "**No secrets detected.**" >> $GITHUB_STEP_SUMMARY
|
||||||
|
else
|
||||||
|
echo "::error::Potential secrets detected in PR commits"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# ── Code Validation ────────────────────────────────────────────────────
|
# ── Code Validation ────────────────────────────────────────────────────
|
||||||
validate:
|
validate:
|
||||||
name: Validate PR
|
name: Validate PR
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# Skip on template repos (Template-*) — no real manifest/source/changelog to validate.
|
||||||
|
if: ${{ !startsWith(github.event.repository.name, 'Template-') }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -121,11 +149,12 @@ jobs:
|
|||||||
- name: Detect platform
|
- name: Detect platform
|
||||||
id: platform
|
id: platform
|
||||||
run: |
|
run: |
|
||||||
# Read platform from XML manifest (<platform> tag) or plain text fallback
|
# Platform comes from the MokoGitea metadata API (public GET); manifest.xml is no longer used.
|
||||||
PLATFORM=$(sed -n 's/.*<platform>\([^<]*\)<\/platform>.*/\1/p' .mokogitea/manifest.xml 2>/dev/null | head -1)
|
API="${GITHUB_SERVER_URL:-https://git.mokoconsulting.tech}/api/v1/repos/${GITHUB_REPOSITORY}/metadata"
|
||||||
[ -z "$PLATFORM" ] && PLATFORM=$(cat .mokogitea/manifest.xml 2>/dev/null | tr -d '[:space:]')
|
PLATFORM="$(curl -sf "$API" 2>/dev/null | python3 -c "import sys, json; print(json.load(sys.stdin).get('platform') or '')" 2>/dev/null || true)"
|
||||||
[ -z "$PLATFORM" ] && PLATFORM="generic"
|
[ -z "$PLATFORM" ] && PLATFORM="generic"
|
||||||
echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT"
|
echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Detected platform: $PLATFORM"
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
if: steps.platform.outputs.platform == 'joomla' || steps.platform.outputs.platform == 'dolibarr'
|
if: steps.platform.outputs.platform == 'joomla' || steps.platform.outputs.platform == 'dolibarr'
|
||||||
@@ -466,43 +495,33 @@ jobs:
|
|||||||
name: Build RC Package
|
name: Build RC Package
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [branch-policy, validate]
|
needs: [branch-policy, validate]
|
||||||
|
# Run only when both gates succeeded; always() forces evaluation so a skipped
|
||||||
|
# validate (e.g. template repos) skips this job cleanly instead of hanging.
|
||||||
|
if: ${{ always() && needs.branch-policy.result == 'success' && needs.validate.result == 'success' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Trigger RC pre-release
|
- name: Trigger RC pre-release
|
||||||
env:
|
env:
|
||||||
GA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
BRANCH: ${{ github.head_ref }}
|
BRANCH: ${{ github.head_ref }}
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
run: |
|
run: |
|
||||||
curl -s -X POST "${GITEA_URL}/api/v1/repos/${REPO}/actions/workflows/pre-release.yml/dispatches" -H "Authorization: token ${GITEA_TOKEN}" -H "Content-Type: application/json" -d "{\"ref\":\"${BRANCH}\",\"inputs\":{\"stability\":\"release-candidate\"}}"
|
curl -s -X POST "${MOKOGITEA_URL}/api/v1/repos/${REPO}/actions/workflows/pre-release.yml/dispatches" -H "Authorization: token ${MOKOGITEA_TOKEN}" -H "Content-Type: application/json" -d "{\"ref\":\"${BRANCH}\",\"inputs\":{\"stability\":\"release-candidate\"}}"
|
||||||
echo "### Pre-Release" >> $GITHUB_STEP_SUMMARY
|
echo "### Pre-Release" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "Triggered RC build on branch \`${BRANCH}\`" >> $GITHUB_STEP_SUMMARY
|
echo "Triggered RC build on branch \`${BRANCH}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# ── Issue Reporter ──────────────────────────────────────────────────────
|
# ── Issue Reporter ──────────────────────────────────────────────────────
|
||||||
report-issues:
|
report-issues:
|
||||||
name: Report Issues
|
name: Report Issues
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [branch-policy, validate]
|
needs: [branch-policy, validate]
|
||||||
if: >-
|
if: >-
|
||||||
always() &&
|
always() &&
|
||||||
needs.validate.result == 'failure'
|
needs.validate.result == 'failure'
|
||||||
|
uses: ./.mokogitea/workflows/ci-issue-reporter.yml
|
||||||
steps:
|
with:
|
||||||
- name: Checkout
|
gate: "PR Validation"
|
||||||
uses: actions/checkout@v4
|
workflow: "PR Check"
|
||||||
with:
|
severity: error
|
||||||
sparse-checkout: automation/ci-issue-reporter.sh
|
details: "PR validation failed (syntax, manifest, changelog, or source checks). See the CI run for the specific check that failed."
|
||||||
sparse-checkout-cone-mode: false
|
secrets: inherit
|
||||||
|
|
||||||
- name: "File issue for PR validation failure"
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
|
||||||
run: |
|
|
||||||
chmod +x automation/ci-issue-reporter.sh
|
|
||||||
./automation/ci-issue-reporter.sh \
|
|
||||||
--gate "PR Validation" \
|
|
||||||
--workflow "PR Check" \
|
|
||||||
--severity error \
|
|
||||||
--details "PR validation failed (syntax, manifest, changelog, or source checks). See the CI run for the specific check that failed."
|
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
|
# FILE INFORMATION
|
||||||
|
# DEFGROUP: Gitea.Workflow
|
||||||
|
# INGROUP: mokocli.Validation
|
||||||
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
|
# PATH: /templates/workflows/joomla/pr-metadata-check.yml.template
|
||||||
|
# VERSION: 01.00.00
|
||||||
|
# BRIEF: Validate MokoGitea metadata matches Joomla extension manifest on PRs
|
||||||
|
|
||||||
|
name: "Joomla: Metadata Validation"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened, converted_to_draft, ready_for_review]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
env:
|
||||||
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
GITEA_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
|
||||||
|
GITEA_REPO: ${{ vars.GITEA_REPO || github.event.repository.name }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate-metadata:
|
||||||
|
name: "Validate Joomla Metadata"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# Skip on template repos (Template-*) — they have no real extension manifest to validate.
|
||||||
|
if: ${{ !startsWith(github.event.repository.name, 'Template-') }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup mokocli tools
|
||||||
|
env:
|
||||||
|
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
MOKO_CLONE_HOST: git.mokoconsulting.tech/MokoConsulting
|
||||||
|
run: |
|
||||||
|
if [ -f /opt/mokocli/cli/joomla_metadata_validate.php ] && [ -f /opt/mokocli/vendor/autoload.php ]; then
|
||||||
|
echo Using pre-installed /opt/mokocli
|
||||||
|
echo MOKO_CLI=/opt/mokocli/cli >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo Falling back to fresh clone
|
||||||
|
if ! command -v composer > /dev/null 2>&1; then
|
||||||
|
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
rm -rf /tmp/mokocli
|
||||||
|
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoCLI.git
|
||||||
|
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli
|
||||||
|
cd /tmp/mokocli && composer install --no-dev --no-interaction --quiet
|
||||||
|
echo MOKO_CLI=/tmp/mokocli/cli >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Validate metadata against Joomla manifest
|
||||||
|
env:
|
||||||
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
run: |
|
||||||
|
php ${MOKO_CLI}/joomla_metadata_validate.php \
|
||||||
|
--path . \
|
||||||
|
--token "${MOKOGITEA_TOKEN}" \
|
||||||
|
--org "${GITEA_ORG}" \
|
||||||
|
--repo "${GITEA_REPO}" \
|
||||||
|
--api-base "${MOKOGITEA_URL}/api/v1" \
|
||||||
|
--ci
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "::error::Joomla metadata mismatch — update delivery will fail. Run 'php cli/joomla_metadata_validate.php' locally to see details."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -4,23 +4,26 @@
|
|||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: mokoplatform.Release
|
# INGROUP: mokocli.Release
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokoplatform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
# PATH: /templates/workflows/universal/pre-release.yml.template
|
# PATH: /templates/workflows/universal/pre-release.yml.template
|
||||||
# VERSION: 05.01.00
|
# VERSION: 05.02.00
|
||||||
# BRIEF: Manual pre-release -- builds dev/alpha/beta/rc packages from any branch
|
# BRIEF: Auto pre-release on push to dev/alpha/beta/rc branches
|
||||||
|
|
||||||
name: "Universal: Pre-Release"
|
name: "Universal: Pre-Release"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
push:
|
||||||
types: [closed]
|
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
pull_request_target:
|
- 'fix/**'
|
||||||
types: [synchronize, opened, reopened]
|
- 'patch/**'
|
||||||
branches:
|
- 'hotfix/**'
|
||||||
- main
|
- 'bugfix/**'
|
||||||
|
- 'chore/**'
|
||||||
|
- alpha
|
||||||
|
- beta
|
||||||
|
- rc
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
stability:
|
stability:
|
||||||
@@ -43,12 +46,15 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: "Build Pre-Release (${{ inputs.stability || 'development' }})"
|
name: "Build Pre-Release (${{ inputs.stability || github.ref_name }})"
|
||||||
runs-on: release
|
runs-on: release
|
||||||
|
# Skip on template repos (Template-*) — they scaffold other repos and do not release.
|
||||||
if: >-
|
if: >-
|
||||||
github.event_name == 'workflow_dispatch' ||
|
!startsWith(github.event.repository.name, 'Template-') &&
|
||||||
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'dev') ||
|
(
|
||||||
(github.event_name == 'pull_request_target' && github.event.pull_request.base.ref == 'main')
|
github.event_name == 'workflow_dispatch' ||
|
||||||
|
github.event_name == 'push'
|
||||||
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -56,40 +62,64 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || '' }}
|
ref: ${{ github.ref_name }}
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup mokoplatform tools
|
- name: Update submodules to main
|
||||||
|
run: |
|
||||||
|
git submodule foreach --quiet 'git checkout main && git pull --quiet origin main' 2>/dev/null || true
|
||||||
|
|
||||||
|
- name: Setup mokocli tools
|
||||||
env:
|
env:
|
||||||
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
MOKO_CLONE_HOST: git.mokoconsulting.tech/MokoConsulting
|
MOKO_CLONE_HOST: git.mokoconsulting.tech/MokoConsulting
|
||||||
run: |
|
run: |
|
||||||
# Use pre-installed /opt/mokoplatform if available (updated by cron every 6h)
|
# Use pre-installed /opt/mokocli if available (updated by cron every 6h)
|
||||||
if [ -f /opt/mokoplatform/cli/version_bump.php ] && [ -f /opt/mokoplatform/cli/manifest_element.php ] && [ -f /opt/mokoplatform/vendor/autoload.php ]; then
|
if [ -f /opt/mokocli/cli/version_bump.php ] && [ -f /opt/mokocli/cli/manifest_element.php ] && [ -f /opt/mokocli/vendor/autoload.php ]; then
|
||||||
echo Using pre-installed /opt/mokoplatform
|
echo Using pre-installed /opt/mokocli
|
||||||
echo MOKO_CLI=/opt/mokoplatform/cli >> $GITHUB_ENV
|
echo MOKO_CLI=/opt/mokocli/cli >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
echo Falling back to fresh clone
|
echo Falling back to fresh clone
|
||||||
if ! command -v composer > /dev/null 2>&1; then
|
if ! command -v composer > /dev/null 2>&1; then
|
||||||
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
|
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
rm -rf /tmp/mokoplatform-api
|
rm -rf /tmp/mokocli
|
||||||
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/mokoplatform.git
|
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoCLI.git
|
||||||
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokoplatform-api
|
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli
|
||||||
cd /tmp/mokoplatform-api && composer install --no-dev --no-interaction --quiet
|
cd /tmp/mokocli && composer install --no-dev --no-interaction --quiet
|
||||||
echo MOKO_CLI=/tmp/mokoplatform-api/cli >> $GITHUB_ENV
|
echo MOKO_CLI=/tmp/mokocli/cli >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Detect platform
|
- name: Detect platform
|
||||||
id: platform
|
id: platform
|
||||||
run: |
|
run: |
|
||||||
|
# Auto-detect and update platform if not set in manifest
|
||||||
|
php ${MOKO_CLI}/platform_detect.php --path . --github-output 2>/dev/null || true
|
||||||
php ${MOKO_CLI}/manifest_read.php --path . --github-output
|
php ${MOKO_CLI}/manifest_read.php --path . --github-output
|
||||||
|
|
||||||
|
- name: Check platform eligibility (Joomla only)
|
||||||
|
id: eligibility
|
||||||
|
run: |
|
||||||
|
PLATFORM="${{ steps.platform.outputs.platform }}"
|
||||||
|
if [[ "$PLATFORM" == joomla* ]] || [[ "$PLATFORM" == "joomla" ]]; then
|
||||||
|
echo "proceed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "proceed=false" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "::notice::Platform '$PLATFORM' — non-Joomla, skipping pre-release auto-bump"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Resolve metadata and bump version
|
- name: Resolve metadata and bump version
|
||||||
id: meta
|
id: meta
|
||||||
|
if: steps.eligibility.outputs.proceed == 'true'
|
||||||
run: |
|
run: |
|
||||||
# Auto-detect stability: RC for PRs targeting main, else use input or default to development
|
# Auto-detect stability from branch name on push, or use input on dispatch
|
||||||
if [ "${{ github.event_name }}" = "pull_request_target" ] && [ "${{ github.event.pull_request.base.ref }}" = "main" ]; then
|
if [ "${{ github.event_name }}" = "push" ]; then
|
||||||
STABILITY="release-candidate"
|
case "${{ github.ref_name }}" in
|
||||||
|
rc) STABILITY="release-candidate" ;;
|
||||||
|
alpha) STABILITY="alpha" ;;
|
||||||
|
beta) STABILITY="beta" ;;
|
||||||
|
*) STABILITY="development" ;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
STABILITY="${{ inputs.stability || 'development' }}"
|
STABILITY="${{ inputs.stability || 'development' }}"
|
||||||
fi
|
fi
|
||||||
@@ -157,6 +187,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
id: release
|
id: release
|
||||||
|
if: steps.eligibility.outputs.proceed == 'true'
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ steps.meta.outputs.tag }}"
|
TAG="${{ steps.meta.outputs.tag }}"
|
||||||
VERSION="${{ steps.meta.outputs.version }}"
|
VERSION="${{ steps.meta.outputs.version }}"
|
||||||
@@ -164,9 +195,10 @@ jobs:
|
|||||||
php ${MOKO_CLI}/release_create.php \
|
php ${MOKO_CLI}/release_create.php \
|
||||||
--path . --version "$VERSION" --tag "$TAG" \
|
--path . --version "$VERSION" --tag "$TAG" \
|
||||||
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "$API_BASE" \
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "$API_BASE" \
|
||||||
--repo "${GITEA_REPO}" --branch dev --prerelease
|
--repo "${GITEA_REPO}" --branch "${{ github.ref_name }}" --prerelease
|
||||||
|
|
||||||
- name: Update release notes from CHANGELOG.md
|
- name: Update release notes from CHANGELOG.md
|
||||||
|
if: steps.eligibility.outputs.proceed == 'true'
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ steps.meta.outputs.tag }}"
|
TAG="${{ steps.meta.outputs.tag }}"
|
||||||
VERSION="${{ steps.meta.outputs.version }}"
|
VERSION="${{ steps.meta.outputs.version }}"
|
||||||
@@ -203,6 +235,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build package and upload
|
- name: Build package and upload
|
||||||
id: package
|
id: package
|
||||||
|
if: steps.eligibility.outputs.proceed == 'true'
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ steps.meta.outputs.version }}"
|
VERSION="${{ steps.meta.outputs.version }}"
|
||||||
TAG="${{ steps.meta.outputs.tag }}"
|
TAG="${{ steps.meta.outputs.tag }}"
|
||||||
@@ -216,6 +249,7 @@ jobs:
|
|||||||
# No need to build, commit, or sync updates.xml from workflows
|
# No need to build, commit, or sync updates.xml from workflows
|
||||||
|
|
||||||
- name: "Delete lesser pre-release channels (cascade)"
|
- name: "Delete lesser pre-release channels (cascade)"
|
||||||
|
if: steps.eligibility.outputs.proceed == 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: MokoPlatform.Universal
|
# INGROUP: mokocli.Universal
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
# PATH: /.mokogitea/workflows/rc-revert.yml
|
# PATH: /.mokogitea/workflows/rc-revert.yml
|
||||||
# VERSION: 09.23.00
|
# VERSION: 09.23.00
|
||||||
# BRIEF: Rename rc/ branch back to dev/ when PR is closed without merge
|
# BRIEF: Rename rc/ branch back to dev/ when PR is closed without merge
|
||||||
@@ -29,12 +29,20 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Rename branch
|
- name: Rename branch
|
||||||
|
env:
|
||||||
|
BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
BRANCH="${{ github.event.pull_request.head.ref }}"
|
set -euo pipefail
|
||||||
|
# BRANCH is attacker-controlled (PR head ref). Strict allowlist before ANY use.
|
||||||
|
if ! printf '%s' "$BRANCH" | grep -Eq '^rc/[A-Za-z0-9._/-]+$'; then
|
||||||
|
echo "::error::Refusing unsafe branch name: $BRANCH"; exit 1
|
||||||
|
fi
|
||||||
SUFFIX="${BRANCH#rc/}"
|
SUFFIX="${BRANCH#rc/}"
|
||||||
DEV_BRANCH="dev/${SUFFIX}"
|
DEV_BRANCH="dev/${SUFFIX}"
|
||||||
API="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}/api/v1/repos/${{ github.repository }}/branches"
|
API="${GITEA_URL}/api/v1/repos/${REPO}/branches"
|
||||||
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
|
||||||
|
|
||||||
# Create dev/ branch from rc/ branch
|
# Create dev/ branch from rc/ branch
|
||||||
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X POST \
|
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X POST \
|
||||||
@@ -42,25 +50,22 @@ jobs:
|
|||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"new_branch_name\": \"${DEV_BRANCH}\", \"old_branch_name\": \"${BRANCH}\"}" \
|
-d "{\"new_branch_name\": \"${DEV_BRANCH}\", \"old_branch_name\": \"${BRANCH}\"}" \
|
||||||
"${API}" 2>/dev/null || true)
|
"${API}" 2>/dev/null || true)
|
||||||
|
|
||||||
if [ "$STATUS" = "201" ]; then
|
if [ "$STATUS" = "201" ]; then
|
||||||
echo "Created branch: ${DEV_BRANCH}" >> $GITHUB_STEP_SUMMARY
|
echo "Created branch: ${DEV_BRANCH}" >> "$GITHUB_STEP_SUMMARY"
|
||||||
else
|
else
|
||||||
echo "::error::Failed to create ${DEV_BRANCH} from ${BRANCH} (HTTP ${STATUS})"
|
echo "::error::Failed to create ${DEV_BRANCH} from ${BRANCH} (HTTP ${STATUS})"; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Delete rc/ branch
|
# Read BRANCH from the environment inside PHP (getenv, no string interpolation -> no PHP injection)
|
||||||
ENCODED=$(php -r "echo rawurlencode('${BRANCH}');")
|
ENCODED=$(php -r 'echo rawurlencode(getenv("BRANCH"));')
|
||||||
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X DELETE \
|
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X DELETE \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${TOKEN}" \
|
||||||
"${API}/${ENCODED}" 2>/dev/null || true)
|
"${API}/${ENCODED}" 2>/dev/null || true)
|
||||||
|
|
||||||
if [ "$STATUS" = "204" ]; then
|
if [ "$STATUS" = "204" ]; then
|
||||||
echo "Deleted branch: ${BRANCH}" >> $GITHUB_STEP_SUMMARY
|
echo "Deleted branch: ${BRANCH}" >> "$GITHUB_STEP_SUMMARY"
|
||||||
else
|
else
|
||||||
echo "::warning::Failed to delete ${BRANCH} (HTTP ${STATUS})"
|
echo "::warning::Failed to delete ${BRANCH} (HTTP ${STATUS})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "### RC Reverted" >> $GITHUB_STEP_SUMMARY
|
echo "### RC Reverted" >> "$GITHUB_STEP_SUMMARY"
|
||||||
echo "${BRANCH} → ${DEV_BRANCH}" >> $GITHUB_STEP_SUMMARY
|
echo "${BRANCH} → ${DEV_BRANCH}" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: moko-platform.Validation
|
# INGROUP: mokocli.Validation
|
||||||
# REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/moko-platform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
|
||||||
# PATH: /templates/workflows/joomla/repo_health.yml.template
|
# PATH: /templates/workflows/joomla/repo_health.yml.template
|
||||||
# VERSION: 09.23.00
|
# VERSION: 09.23.00
|
||||||
# BRIEF: Enforces repository guardrails by validating scripts governance, tooling availability, and core repository health artifacts.
|
# BRIEF: Enforces repository guardrails by validating scripts governance, tooling availability, and core repository health artifacts.
|
||||||
@@ -77,7 +77,7 @@ jobs:
|
|||||||
- name: Check actor permission (admin only)
|
- name: Check actor permission (admin only)
|
||||||
id: perm
|
id: perm
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.MOKOGITEA_TOKEN || secrets.MOKOGITEA_TOKEN || github.token }}
|
TOKEN: ${{ secrets.MOKOGITEA_TOKEN || github.token }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
ACTOR: ${{ github.actor }}
|
ACTOR: ${{ github.actor }}
|
||||||
run: |
|
run: |
|
||||||
@@ -671,42 +671,30 @@ jobs:
|
|||||||
# ═══════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════
|
||||||
# Issue Reporter — file issues for failed gates
|
# Issue Reporter — file issues for failed gates
|
||||||
# ═══════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════
|
||||||
report-issues:
|
report-scripts:
|
||||||
name: "Report Issues"
|
name: "Report: Scripts Governance"
|
||||||
runs-on: ubuntu-latest
|
needs: [access_check, scripts_governance]
|
||||||
needs: [access_check, scripts_governance, repo_health]
|
|
||||||
if: >-
|
if: >-
|
||||||
always() &&
|
always() &&
|
||||||
(needs.scripts_governance.result == 'failure' ||
|
needs.scripts_governance.result == 'failure'
|
||||||
needs.repo_health.result == 'failure')
|
uses: ./.mokogitea/workflows/ci-issue-reporter.yml
|
||||||
|
with:
|
||||||
|
gate: "Scripts Governance"
|
||||||
|
workflow: "Repo Health"
|
||||||
|
severity: error
|
||||||
|
details: "Scripts directory policy violations detected. Review required and allowed directories."
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
steps:
|
report-health:
|
||||||
- name: Checkout
|
name: "Report: Repository Health"
|
||||||
uses: actions/checkout@v4
|
needs: [access_check, repo_health]
|
||||||
with:
|
if: >-
|
||||||
sparse-checkout: automation/ci-issue-reporter.sh
|
always() &&
|
||||||
sparse-checkout-cone-mode: false
|
needs.repo_health.result == 'failure'
|
||||||
|
uses: ./.mokogitea/workflows/ci-issue-reporter.yml
|
||||||
- name: "File issues for failed gates"
|
with:
|
||||||
env:
|
gate: "Repository Health"
|
||||||
GITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
workflow: "Repo Health"
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
severity: error
|
||||||
run: |
|
details: "Repository health checks failed — missing required artifacts, disallowed files, or content warnings. Check the CI run summary."
|
||||||
chmod +x automation/ci-issue-reporter.sh
|
secrets: inherit
|
||||||
REPORTER="./automation/ci-issue-reporter.sh"
|
|
||||||
WF="Repo Health"
|
|
||||||
|
|
||||||
report_gate() {
|
|
||||||
local gate="$1" result="$2" details="$3"
|
|
||||||
if [ "$result" = "failure" ]; then
|
|
||||||
"$REPORTER" --gate "$gate" --details "$details" --workflow "$WF" --severity error
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
report_gate "Scripts Governance" \
|
|
||||||
"${{ needs.scripts_governance.result }}" \
|
|
||||||
"Scripts directory policy violations detected. Review required and allowed directories."
|
|
||||||
|
|
||||||
report_gate "Repository Health" \
|
|
||||||
"${{ needs.repo_health.result }}" \
|
|
||||||
"Repository health checks failed — missing required artifacts, disallowed files, or content warnings. Check the CI run summary."
|
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
#
|
|
||||||
# FILE INFORMATION
|
|
||||||
# DEFGROUP: Gitea.Workflow
|
|
||||||
# INGROUP: MokoStandards.Security
|
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards
|
|
||||||
# PATH: /.gitea/workflows/security-audit.yml
|
|
||||||
# VERSION: 01.00.00
|
|
||||||
# BRIEF: Dependency vulnerability scanning for composer and npm packages
|
|
||||||
|
|
||||||
name: "Universal: Security Audit"
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 6 * * 1' # Weekly on Monday at 06:00 UTC
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'composer.json'
|
|
||||||
- 'composer.lock'
|
|
||||||
- 'package.json'
|
|
||||||
- 'package-lock.json'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
env:
|
|
||||||
NTFY_URL: ${{ vars.NTFY_URL || 'https://ntfy.mokoconsulting.tech' }}
|
|
||||||
NTFY_TOPIC: ${{ vars.NTFY_TOPIC || 'gitea-security' }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
audit:
|
|
||||||
name: Dependency Audit
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Composer audit
|
|
||||||
if: hashFiles('composer.lock') != ''
|
|
||||||
run: |
|
|
||||||
echo "=== Composer Security Audit ==="
|
|
||||||
if ! command -v composer &> /dev/null; then
|
|
||||||
sudo apt-get update -qq
|
|
||||||
sudo apt-get install -y -qq php-cli composer >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
composer audit --format=plain 2>&1 | tee /tmp/composer-audit.txt
|
|
||||||
RESULT=$?
|
|
||||||
if [ $RESULT -ne 0 ]; then
|
|
||||||
echo "::warning::Composer vulnerabilities found"
|
|
||||||
echo "composer_vulnerable=true" >> "$GITHUB_ENV"
|
|
||||||
else
|
|
||||||
echo "No known vulnerabilities in composer dependencies"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: NPM audit
|
|
||||||
if: hashFiles('package-lock.json') != ''
|
|
||||||
run: |
|
|
||||||
echo "=== NPM Security Audit ==="
|
|
||||||
npm audit --production 2>&1 | tee /tmp/npm-audit.txt || true
|
|
||||||
if npm audit --production 2>&1 | grep -q "found 0 vulnerabilities"; then
|
|
||||||
echo "No known vulnerabilities in npm dependencies"
|
|
||||||
else
|
|
||||||
echo "::warning::NPM vulnerabilities found"
|
|
||||||
echo "npm_vulnerable=true" >> "$GITHUB_ENV"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Notify on vulnerabilities
|
|
||||||
if: env.composer_vulnerable == 'true' || env.npm_vulnerable == 'true'
|
|
||||||
run: |
|
|
||||||
REPO="${{ github.event.repository.name }}"
|
|
||||||
curl -sS \
|
|
||||||
-H "Title: ${REPO} has vulnerable dependencies" \
|
|
||||||
-H "Tags: lock,warning" \
|
|
||||||
-H "Priority: high" \
|
|
||||||
-d "Security audit found vulnerabilities. Review dependency updates." \
|
|
||||||
"${NTFY_URL}/${NTFY_TOPIC}" || true
|
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
|
# FILE INFORMATION
|
||||||
|
# DEFGROUP: Gitea.Workflow.Template
|
||||||
|
# INGROUP: MokoStandards.CI
|
||||||
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla
|
||||||
|
# PATH: /.mokogitea/workflows/version-set.yml
|
||||||
|
# VERSION: 01.00.00
|
||||||
|
# BRIEF: Set or reset the extension version across all version-bearing files
|
||||||
|
|
||||||
|
name: "Joomla: Set Version"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Version number (e.g. 01.00.00)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
branch:
|
||||||
|
description: "Branch to update (default: current)"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
set-version:
|
||||||
|
name: Set Version to ${{ inputs.version }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Validate version format
|
||||||
|
run: |
|
||||||
|
VERSION="${{ inputs.version }}"
|
||||||
|
if ! echo "$VERSION" | grep -qP '^\d{2}\.\d{2}\.\d{2}$'; then
|
||||||
|
echo "::error::Invalid version format '${VERSION}' — expected XX.YY.ZZ (e.g. 01.00.00)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.MOKOGITEA_TOKEN || github.token }}
|
||||||
|
ref: ${{ inputs.branch || github.ref }}
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Update manifest version
|
||||||
|
run: |
|
||||||
|
MANIFEST=""
|
||||||
|
for XML_FILE in $(find . -maxdepth 3 -name "*.xml" -not -path "./.git/*" -not -path "./vendor/*"); do
|
||||||
|
if grep -q "<extension" "$XML_FILE" 2>/dev/null; then
|
||||||
|
MANIFEST="$XML_FILE"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$MANIFEST" ]; then
|
||||||
|
echo "::warning::No Joomla extension manifest found — skipping manifest update"
|
||||||
|
else
|
||||||
|
OLD_VER=$(grep -oP '<version>\K[^<]+' "$MANIFEST" | head -1)
|
||||||
|
sed -i "s|<version>${OLD_VER}</version>|<version>${VERSION}</version>|" "$MANIFEST"
|
||||||
|
echo "Manifest: ${OLD_VER} → ${VERSION} (${MANIFEST})"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Update README.md version
|
||||||
|
run: |
|
||||||
|
if [ -f "README.md" ]; then
|
||||||
|
if grep -qP '^\s*VERSION:\s*\d' README.md; then
|
||||||
|
sed -i -E "s/(VERSION:\s*)[0-9]{2}\.[0-9]{2}\.[0-9]{2}/\1${VERSION}/" README.md
|
||||||
|
echo "README.md version updated to ${VERSION}"
|
||||||
|
else
|
||||||
|
echo "::warning::No VERSION line found in README.md — skipping"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Update CHANGELOG.md
|
||||||
|
run: |
|
||||||
|
if [ -f "CHANGELOG.md" ]; then
|
||||||
|
DATE=$(date +%Y-%m-%d)
|
||||||
|
# Check if this version already has an entry
|
||||||
|
if grep -q "^\#\# \[${VERSION}\]" CHANGELOG.md; then
|
||||||
|
echo "CHANGELOG.md already has entry for ${VERSION} — skipping"
|
||||||
|
else
|
||||||
|
# Insert new version entry after [Unreleased] or at the top after header
|
||||||
|
if grep -q '^\#\# \[Unreleased\]' CHANGELOG.md; then
|
||||||
|
sed -i "/^\#\# \[Unreleased\]/a\\\\n## [${VERSION}] --- ${DATE}" CHANGELOG.md
|
||||||
|
else
|
||||||
|
sed -i "/^\# Changelog/a\\\\n## [Unreleased]\n\n## [${VERSION}] --- ${DATE}" CHANGELOG.md
|
||||||
|
fi
|
||||||
|
echo "CHANGELOG.md: added entry for ${VERSION}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "::warning::No CHANGELOG.md found — skipping"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Update FILE INFORMATION blocks
|
||||||
|
run: |
|
||||||
|
# Update VERSION in file header blocks (# VERSION: XX.YY.ZZ)
|
||||||
|
find . -maxdepth 1 -type f \( -name "*.yml" -o -name "*.yaml" -o -name "*.php" -o -name "*.md" \) \
|
||||||
|
-not -path "./.git/*" -not -path "./vendor/*" -print0 2>/dev/null | \
|
||||||
|
while IFS= read -r -d '' FILE; do
|
||||||
|
if head -20 "$FILE" | grep -qP '^\s*#?\s*VERSION:\s*\d{2}\.\d{2}\.\d{2}'; then
|
||||||
|
sed -i -E "s/(#?\s*VERSION:\s*)[0-9]{2}\.[0-9]{2}\.[0-9]{2}/\1${VERSION}/" "$FILE"
|
||||||
|
echo "Updated FILE INFORMATION VERSION in ${FILE}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Commit and push
|
||||||
|
run: |
|
||||||
|
git config user.name "Moko Consulting [bot]"
|
||||||
|
git config user.email "hello@mokoconsulting.tech"
|
||||||
|
git add -A
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "No version changes detected — nothing to commit"
|
||||||
|
else
|
||||||
|
git commit -m "chore: set version to ${VERSION} [skip bump]
|
||||||
|
|
||||||
|
Authored-by: Moko Consulting"
|
||||||
|
git push
|
||||||
|
echo "### Version Set" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "Version updated to \`${VERSION}\` on branch \`${GITHUB_REF_NAME}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
fi
|
||||||
@@ -8,4 +8,5 @@
|
|||||||
- HCL definition files removed -- Template repos are now the canonical source
|
- HCL definition files removed -- Template repos are now the canonical source
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- CI: gate build/CI/release/version workflows so they skip template repos; smart-gate the sync workflows to run only on Template-* repos; normalize mokocli/MokoCLI refs and drop the stale mokoconsulting-tech org slug.
|
||||||
- `branch-cleanup.yml`: auto-delete merged feature branches after PR merge
|
- `branch-cleanup.yml`: auto-delete merged feature branches after PR merge
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ This file provides guidance to Claude Code when working with this repository.
|
|||||||
| **Default branch** | main |
|
| **Default branch** | main |
|
||||||
| **License** | GPL-3.0-or-later |
|
| **License** | GPL-3.0-or-later |
|
||||||
| **Wiki** | [Template-Joomla Wiki](https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla/wiki) |
|
| **Wiki** | [Template-Joomla Wiki](https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla/wiki) |
|
||||||
| **Standards** | [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home) |
|
| **Standards** | [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoCLI/wiki/Home) |
|
||||||
|
|
||||||
## Common Commands
|
## Common Commands
|
||||||
|
|
||||||
@@ -44,4 +44,4 @@ This is a project template. Files are copied when creating new repos.
|
|||||||
- **Branch strategy**: develop on `dev`, merge to `main` for release
|
- **Branch strategy**: develop on `dev`, merge to `main` for release
|
||||||
- **Minification**: handled at build time (CI) and runtime (MokoMinifyHelper for Joomla templates)
|
- **Minification**: handled at build time (CI) and runtime (MokoMinifyHelper for Joomla templates)
|
||||||
- **Wiki**: documentation lives in the Gitea wiki, not in `docs/` files
|
- **Wiki**: documentation lives in the Gitea wiki, not in `docs/` files
|
||||||
- **Standards**: this repo follows [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home)
|
- **Standards**: this repo follows [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoCLI/wiki/Home)
|
||||||
|
|||||||
+3
-3
@@ -11,9 +11,9 @@
|
|||||||
You should have received a copy of the GNU General Public License (./LICENSE).
|
You should have received a copy of the GNU General Public License (./LICENSE).
|
||||||
|
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
DEFGROUP: MokoStandards-Template-Joomla-Plugin
|
DEFGROUP: Template-Joomla
|
||||||
INGROUP: MokoStandards-Template-Joomla-Plugin.Documentation
|
INGROUP: Template-Joomla.Documentation
|
||||||
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin/
|
REPO: https://github.com/mokoconsulting-tech/Template-Joomla/
|
||||||
VERSION: 01.01.00
|
VERSION: 01.01.00
|
||||||
PATH: ./CODE_OF_CONDUCT.md
|
PATH: ./CODE_OF_CONDUCT.md
|
||||||
BRIEF: Community expectations and enforcement guidelines
|
BRIEF: Community expectations and enforcement guidelines
|
||||||
|
|||||||
+7
-7
@@ -16,12 +16,12 @@
|
|||||||
You should have received a copy of the GNU General Public License (./LICENSE).
|
You should have received a copy of the GNU General Public License (./LICENSE).
|
||||||
|
|
||||||
FILE INFORMATION
|
FILE INFORMATION
|
||||||
DEFGROUP: mokoconsulting-tech.MokoStandards-Template-Joomla-Plugin
|
DEFGROUP: mokoconsulting-tech.Template-Joomla
|
||||||
INGROUP: MokoStandards.Governance
|
INGROUP: MokoStandards.Governance
|
||||||
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin
|
REPO: https://github.com/mokoconsulting-tech/Template-Joomla
|
||||||
VERSION: 01.01.00
|
VERSION: 01.01.00
|
||||||
PATH: /GOVERNANCE.md
|
PATH: /GOVERNANCE.md
|
||||||
BRIEF: Project governance rules, roles, and decision process for MokoStandards-Template-Joomla-Plugin
|
BRIEF: Project governance rules, roles, and decision process for Template-Joomla
|
||||||
-->
|
-->
|
||||||
|
|
||||||
[](https://github.com/mokoconsulting-tech/MokoStandards)
|
[](https://github.com/mokoconsulting-tech/MokoStandards)
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
This document defines the governance model for the `MokoStandards-Template-Joomla-Plugin` repository within the
|
This document defines the governance model for the `Template-Joomla` repository within the
|
||||||
`mokoconsulting-tech` organization. It is automatically maintained by
|
`mokoconsulting-tech` organization. It is automatically maintained by
|
||||||
[MokoStandards](https://github.com/mokoconsulting-tech/MokoStandards) v04.00.04.
|
[MokoStandards](https://github.com/mokoconsulting-tech/MokoStandards) v04.00.04.
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ See the full policy:
|
|||||||
|
|
||||||
## Reporting Issues
|
## Reporting Issues
|
||||||
|
|
||||||
- **Bugs / Features**: Open a [GitHub Issue](https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin/issues)
|
- **Bugs / Features**: Open a [GitHub Issue](https://github.com/mokoconsulting-tech/Template-Joomla/issues)
|
||||||
- **Security vulnerabilities**: See [SECURITY.md](./SECURITY.md)
|
- **Security vulnerabilities**: See [SECURITY.md](./SECURITY.md)
|
||||||
- **Code of Conduct**: See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md)
|
- **Code of Conduct**: See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md)
|
||||||
- **Contact**: dev@mokoconsulting.tech
|
- **Contact**: dev@mokoconsulting.tech
|
||||||
@@ -110,10 +110,10 @@ See the full policy:
|
|||||||
| ------------- | ----------------------------------------------- |
|
| ------------- | ----------------------------------------------- |
|
||||||
| Document Type | Policy |
|
| Document Type | Policy |
|
||||||
| Domain | Governance |
|
| Domain | Governance |
|
||||||
| Applies To | mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin |
|
| Applies To | mokoconsulting-tech/Template-Joomla |
|
||||||
| Jurisdiction | Tennessee, USA |
|
| Jurisdiction | Tennessee, USA |
|
||||||
| Maintainer | @mokoconsulting-tech |
|
| Maintainer | @mokoconsulting-tech |
|
||||||
| Standards | MokoStandards v04.00.04 |
|
| Standards | MokoStandards v04.00.04 |
|
||||||
| Repo | https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin |
|
| Repo | https://github.com/mokoconsulting-tech/Template-Joomla |
|
||||||
| Path | /GOVERNANCE.md |
|
| Path | /GOVERNANCE.md |
|
||||||
| Status | Active — auto-maintained by MokoStandards |
|
| Status | Active — auto-maintained by MokoStandards |
|
||||||
|
|||||||
@@ -1,172 +0,0 @@
|
|||||||
# Makefile for Joomla Extensions
|
|
||||||
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
#
|
|
||||||
# MokoJoomGallery — Photo gallery management for Joomla
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# CONFIGURATION - Customize these for your extension
|
|
||||||
# ==============================================================================
|
|
||||||
|
|
||||||
# Extension Configuration
|
|
||||||
EXTENSION_NAME := mokojoomgallery
|
|
||||||
EXTENSION_TYPE := package
|
|
||||||
# Options: module, plugin, component, package, template
|
|
||||||
EXTENSION_VERSION := 1.0.0
|
|
||||||
|
|
||||||
# Module Configuration (for modules only)
|
|
||||||
MODULE_TYPE := site
|
|
||||||
# Options: site, admin
|
|
||||||
|
|
||||||
# Plugin Configuration (for plugins only)
|
|
||||||
PLUGIN_GROUP := system
|
|
||||||
# Options: system, content, user, authentication, etc.
|
|
||||||
|
|
||||||
# Directories
|
|
||||||
SRC_DIR := src
|
|
||||||
BUILD_DIR := build
|
|
||||||
DIST_DIR := dist
|
|
||||||
DOCS_DIR := docs
|
|
||||||
|
|
||||||
# Joomla Installation (for local testing - customize paths)
|
|
||||||
JOOMLA_ROOT := /var/www/html/joomla
|
|
||||||
JOOMLA_VERSION := 4
|
|
||||||
|
|
||||||
# Tools
|
|
||||||
PHP := php
|
|
||||||
COMPOSER := composer
|
|
||||||
NPM := npm
|
|
||||||
PHPCS := vendor/bin/phpcs
|
|
||||||
PHPCBF := vendor/bin/phpcbf
|
|
||||||
PHPUNIT := vendor/bin/phpunit
|
|
||||||
ZIP := zip
|
|
||||||
|
|
||||||
# Coding Standards
|
|
||||||
PHPCS_STANDARD := Joomla
|
|
||||||
|
|
||||||
# Colors for output
|
|
||||||
COLOR_RESET := \033[0m
|
|
||||||
COLOR_GREEN := \033[32m
|
|
||||||
COLOR_YELLOW := \033[33m
|
|
||||||
COLOR_BLUE := \033[34m
|
|
||||||
COLOR_RED := \033[31m
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# TARGETS
|
|
||||||
# ==============================================================================
|
|
||||||
|
|
||||||
.PHONY: help
|
|
||||||
help: ## Show this help message
|
|
||||||
@echo "$(COLOR_BLUE)╔════════════════════════════════════════════════════════════╗$(COLOR_RESET)"
|
|
||||||
@echo "$(COLOR_BLUE)║ Joomla Extension Makefile ║$(COLOR_RESET)"
|
|
||||||
@echo "$(COLOR_BLUE)╚════════════════════════════════════════════════════════════╝$(COLOR_RESET)"
|
|
||||||
@echo ""
|
|
||||||
@echo "Extension: $(EXTENSION_NAME) ($(EXTENSION_TYPE)) v$(EXTENSION_VERSION)"
|
|
||||||
@echo ""
|
|
||||||
@echo "$(COLOR_GREEN)Available targets:$(COLOR_RESET)"
|
|
||||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " $(COLOR_BLUE)%-20s$(COLOR_RESET) %s\n", $$1, $$2}'
|
|
||||||
@echo ""
|
|
||||||
|
|
||||||
.PHONY: install-deps
|
|
||||||
install-deps: ## Install all dependencies (Composer + npm)
|
|
||||||
@echo "$(COLOR_BLUE)Installing dependencies...$(COLOR_RESET)"
|
|
||||||
@if [ -f "composer.json" ]; then \
|
|
||||||
$(COMPOSER) install; \
|
|
||||||
echo "$(COLOR_GREEN)✓ Composer dependencies installed$(COLOR_RESET)"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
.PHONY: lint
|
|
||||||
lint: ## Run PHP linter (syntax check)
|
|
||||||
@echo "$(COLOR_BLUE)Running PHP linter...$(COLOR_RESET)"
|
|
||||||
@find . -name "*.php" ! -path "./vendor/*" ! -path "./node_modules/*" ! -path "./$(BUILD_DIR)/*" \
|
|
||||||
-exec $(PHP) -l {} \; | grep -v "No syntax errors" || true
|
|
||||||
@echo "$(COLOR_GREEN)✓ PHP linting complete$(COLOR_RESET)"
|
|
||||||
|
|
||||||
.PHONY: phpcs
|
|
||||||
phpcs: ## Run PHP CodeSniffer (Joomla standards)
|
|
||||||
@echo "$(COLOR_BLUE)Running PHP CodeSniffer...$(COLOR_RESET)"
|
|
||||||
@if [ -f "$(PHPCS)" ]; then \
|
|
||||||
$(PHPCS) --standard=$(PHPCS_STANDARD) --extensions=php --ignore=vendor,node_modules,$(BUILD_DIR) .; \
|
|
||||||
else \
|
|
||||||
echo "$(COLOR_YELLOW)⚠ PHP CodeSniffer not installed. Run: make install-deps$(COLOR_RESET)"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
.PHONY: validate
|
|
||||||
validate: lint phpcs ## Run all validation checks
|
|
||||||
@echo "$(COLOR_GREEN)✓ All validation checks passed$(COLOR_RESET)"
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean: ## Clean build artifacts
|
|
||||||
@echo "$(COLOR_BLUE)Cleaning build artifacts...$(COLOR_RESET)"
|
|
||||||
@rm -rf $(BUILD_DIR) $(DIST_DIR)
|
|
||||||
@echo "$(COLOR_GREEN)✓ Build artifacts cleaned$(COLOR_RESET)"
|
|
||||||
|
|
||||||
MOKO_PLATFORM ?= $(or $(wildcard ../moko-platform),$(wildcard $(HOME)/moko-platform),$(wildcard /opt/moko-platform))
|
|
||||||
MINIFY_SCRIPT := $(MOKO_PLATFORM)/build/minify.js
|
|
||||||
|
|
||||||
.PHONY: minify
|
|
||||||
minify: ## Minify CSS/JS assets
|
|
||||||
@echo "Minifying assets..."
|
|
||||||
@if [ -f "$(MINIFY_SCRIPT)" ]; then \
|
|
||||||
node "$(MINIFY_SCRIPT)" $(SRC_DIR); \
|
|
||||||
elif [ -f "scripts/minify.js" ]; then \
|
|
||||||
node scripts/minify.js; \
|
|
||||||
else \
|
|
||||||
echo "No minify script found"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
build: clean minify ## Build extension package
|
|
||||||
@echo "$(COLOR_BLUE)Building Joomla package extension...$(COLOR_RESET)"
|
|
||||||
@mkdir -p $(DIST_DIR) $(BUILD_DIR)/packages
|
|
||||||
|
|
||||||
@# --- Build each sub-extension as a separate ZIP ---
|
|
||||||
@for EXT_DIR in $(SRC_DIR)/packages/*/; do \
|
|
||||||
EXT_NAME=$$(basename "$$EXT_DIR"); \
|
|
||||||
[ "$$EXT_NAME" = "index.html" ] && continue; \
|
|
||||||
echo " Packaging $$EXT_NAME..."; \
|
|
||||||
cd "$$EXT_DIR" && $(ZIP) -r "$(CURDIR)/$(BUILD_DIR)/packages/$${EXT_NAME}.zip" . \
|
|
||||||
-x "*.git*" -x "*/index.html" 2>/dev/null; \
|
|
||||||
cd "$(CURDIR)"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
@# --- Build the outer package ZIP ---
|
|
||||||
@echo " Assembling pkg_$(EXTENSION_NAME)..."
|
|
||||||
@cp $(SRC_DIR)/pkg_mokojoomgallery.xml $(BUILD_DIR)/pkg_mokojoomgallery.xml
|
|
||||||
@cp $(SRC_DIR)/script.php $(BUILD_DIR)/script.php
|
|
||||||
@[ -d "$(SRC_DIR)/language" ] && cp -r $(SRC_DIR)/language $(BUILD_DIR)/language || true
|
|
||||||
@cd $(BUILD_DIR) && $(ZIP) -r "$(CURDIR)/$(DIST_DIR)/pkg_$(EXTENSION_NAME)-$(EXTENSION_VERSION).zip" \
|
|
||||||
pkg_mokojoomgallery.xml script.php language/ packages/
|
|
||||||
|
|
||||||
@echo "$(COLOR_GREEN)✓ Package created: $(DIST_DIR)/pkg_$(EXTENSION_NAME)-$(EXTENSION_VERSION).zip$(COLOR_RESET)"
|
|
||||||
@echo " Contents:"
|
|
||||||
@unzip -l "$(DIST_DIR)/pkg_$(EXTENSION_NAME)-$(EXTENSION_VERSION).zip" | tail -n +4 | head -20
|
|
||||||
|
|
||||||
.PHONY: package
|
|
||||||
package: build ## Alias for build
|
|
||||||
@echo "$(COLOR_GREEN)✓ Package ready for distribution$(COLOR_RESET)"
|
|
||||||
|
|
||||||
.PHONY: release
|
|
||||||
release: validate build ## Create a release (validate + build)
|
|
||||||
@echo "$(COLOR_GREEN)✓ Release package ready$(COLOR_RESET)"
|
|
||||||
|
|
||||||
.PHONY: version
|
|
||||||
version: ## Display version information
|
|
||||||
@echo "$(COLOR_BLUE)Extension Information:$(COLOR_RESET)"
|
|
||||||
@echo " Name: $(EXTENSION_NAME)"
|
|
||||||
@echo " Type: $(EXTENSION_TYPE)"
|
|
||||||
@echo " Version: $(EXTENSION_VERSION)"
|
|
||||||
|
|
||||||
.PHONY: security-check
|
|
||||||
security-check: ## Run security checks on dependencies
|
|
||||||
@echo "$(COLOR_BLUE)Running security checks...$(COLOR_RESET)"
|
|
||||||
@if [ -f "composer.json" ]; then \
|
|
||||||
$(COMPOSER) audit || echo "$(COLOR_YELLOW)⚠ Vulnerabilities found$(COLOR_RESET)"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: install-deps validate build ## Run complete build pipeline
|
|
||||||
@echo "$(COLOR_GREEN)✓ Complete build pipeline finished$(COLOR_RESET)"
|
|
||||||
|
|
||||||
# Default target
|
|
||||||
.DEFAULT_GOAL := help
|
|
||||||
@@ -1,70 +1,77 @@
|
|||||||
# MokoStandards-Template-Joomla
|
# Template-Joomla
|
||||||
|
|
||||||
Unified scaffolding templates for all Joomla extension types.
|
Unified scaffolding templates for all Joomla extension types — component, template, module, plugin, package, and library.
|
||||||
|
|
||||||
## Structure
|
## Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
.gitea/workflows/ ← Standard 10-workflow CI/CD suite
|
.mokogitea/workflows/ ← CI/CD workflow suite (lint, validate, release)
|
||||||
types/
|
samples/
|
||||||
plugin/ ← Joomla plugin scaffold
|
manifest/ ← Reference manifest XML for each extension type
|
||||||
template/ ← Joomla site template scaffold (full src/)
|
component_sample.xml
|
||||||
module/ ← Joomla module scaffold
|
template_sample.xml
|
||||||
component/ ← Joomla component scaffold
|
module_sample.xml
|
||||||
package/ ← Joomla package scaffold
|
plugin_sample.xml
|
||||||
library/ ← Joomla library scaffold
|
package_sample.xml
|
||||||
|
library_sample.xml
|
||||||
|
script/ ← Reference install/update script (script.php) templates
|
||||||
|
script_component.php
|
||||||
|
script_module.php
|
||||||
|
script_plugin.php
|
||||||
|
script_package.php
|
||||||
|
source/ ← Your extension source lives here (CI scans this dir)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
1. Create a new repo from this template (or clone manually)
|
1. Create a new repo from this template (or clone manually).
|
||||||
2. Copy the relevant `types/<type>/` content to your project root
|
2. Build your extension under `source/`.
|
||||||
3. Customize the manifest XML, namespace, and source files
|
3. Copy the matching manifest from `samples/manifest/` to `source/`, rename it, and
|
||||||
4. Workflows are already configured — push to trigger CI
|
replace the placeholder name, namespace, and version.
|
||||||
|
4. If your extension needs install/update logic, copy the matching
|
||||||
|
`samples/script/` file and replace the `{REPONAME}`/`{PACKAGENAME}` placeholders.
|
||||||
|
5. Push — the workflows validate the manifest, source, SQL, language keys, and build.
|
||||||
|
|
||||||
## Shared Files
|
## Samples
|
||||||
|
|
||||||
The root contains files shared by all extension types:
|
`samples/` holds read-only reference material — do not build against it directly.
|
||||||
- `.gitea/workflows/` — CI/CD (auto-release, ci-joomla, pr-check, etc.)
|
|
||||||
- `.editorconfig`, `.gitignore`, `.gitattributes` — editor/git config
|
|
||||||
- `composer.json`, `phpstan.neon`, `Makefile` — build tooling
|
|
||||||
- `updates.xml` — Joomla update server manifest template
|
|
||||||
- `LICENSE`, `SECURITY.md`, `CONTRIBUTING.md` — standard docs
|
|
||||||
|
|
||||||
## Workflow Suite (10 workflows)
|
- **`manifest/`** — a well-formed `<extension>` manifest for each of the six
|
||||||
|
Joomla extension types, showing the expected structure, namespace declaration,
|
||||||
|
media/SQL wiring, and update-server hookup.
|
||||||
|
- **`script/`** — the standard `script.php` install/uninstall/update handler
|
||||||
|
pattern shared across Moko extension repos. Copy, then replace `{REPONAME}`
|
||||||
|
(UPPERCASE) and `{PACKAGENAME}` (e.g. `com_myextension`).
|
||||||
|
|
||||||
| Workflow | Purpose |
|
## CI/CD
|
||||||
|----------|---------|
|
|
||||||
| `auto-release.yml` | Stable release on PR merge to main |
|
|
||||||
| `pre-release.yml` | Manual dev/alpha/beta/rc builds |
|
|
||||||
| `ci-joomla.yml` | PHP lint, PHPStan, coding standards |
|
|
||||||
| `pr-check.yml` | PR gate: manifest + build validation |
|
|
||||||
| `deploy-manual.yml` | Manual SFTP deploy |
|
|
||||||
| `repo-health.yml` | Structure compliance checks |
|
|
||||||
| `update-server.yml` | updates.xml validation |
|
|
||||||
| `security-audit.yml` | Dependency vulnerability scanning |
|
|
||||||
| `notify.yml` | ntfy notifications |
|
|
||||||
| `cleanup.yml` | Merged branch + old run cleanup |
|
|
||||||
|
|
||||||
## Version Policy
|
`.mokogitea/workflows/ci-joomla.yml` validates every push and PR against `source/`:
|
||||||
|
|
||||||
- **Stable** (PR merge to main): Minor bump (`03.00.07` -> `03.01.00`)
|
| Check | What it verifies |
|
||||||
- **Pre-release** (manual): Patch bump (`03.00.07` -> `03.00.08`)
|
|-------|------------------|
|
||||||
|
| Manifest | Well-formed XML, required elements, version |
|
||||||
|
| SQL | `#__` prefixes, `IF [NOT] EXISTS`, `ENGINE=InnoDB`, `utf8mb4`, install/uninstall pairing, version-named update files |
|
||||||
|
| Language keys | Keys used in code are defined; orphan (unused) keys flagged |
|
||||||
|
| PHP CodeSniffer | Joomla coding standard (falls back to PSR-12) |
|
||||||
|
| Security | No direct superglobals, raw SQL in `setQuery()`, `eval()`, or missing `_JEXEC` guard |
|
||||||
|
| updates.xml | Well-formed, required `<update>` children, `<targetplatform>` |
|
||||||
|
| Assets | `joomla.asset.json` is valid and its URIs exist |
|
||||||
|
| MVC naming | View/Controller/Model/Table classes follow suffix conventions |
|
||||||
|
| Router | Components ship a Router implementing the router interface |
|
||||||
|
| ACL | `access.xml` action keys are defined in language files |
|
||||||
|
| Webservices | Webservices plugins register API routes |
|
||||||
|
| ZIP dry-run | Every file/folder the manifest references actually exists |
|
||||||
|
| JS/CSS | Syntax + balanced braces (ESLint/Stylelint if configured) |
|
||||||
|
|
||||||
## Release Cascade
|
## Standards
|
||||||
|
|
||||||
Higher releases auto-delete lower pre-release channels:
|
This repo follows [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoCLI/wiki/Home).
|
||||||
- stable -> all | rc -> beta,alpha,dev | beta -> alpha,dev | alpha -> dev
|
Documentation lives in the [Template-Joomla Wiki](https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla/wiki).
|
||||||
|
|
||||||
## Platform Type
|
|
||||||
|
|
||||||
`.mokostandards` platform: `joomla-template` or `waas-component`
|
|
||||||
|
|
||||||
## Canonical Source
|
|
||||||
|
|
||||||
This repo is the **single source of truth** for Joomla workflows and scaffolding.
|
|
||||||
Sync to production repos by copying `.gitea/workflows/` from here.
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
GPL-3.0-or-later - Moko Consulting
|
GPL-3.0-or-later — Moko Consulting
|
||||||
|
|
||||||
|
## Template CI Notes
|
||||||
|
|
||||||
|
Build/CI/release/version workflows are guarded to skip template repos (Template-*) and only run in repos created from them.
|
||||||
|
|||||||
+5
-5
@@ -19,9 +19,9 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
DEFGROUP: MokoStandards-Template-Joomla-Plugin
|
DEFGROUP: Template-Joomla
|
||||||
INGROUP: MokoStandards-Template-Joomla-Plugin.Documentation
|
INGROUP: Template-Joomla.Documentation
|
||||||
REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-Template-Joomla-Plugin
|
REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla
|
||||||
PATH: /SECURITY.md
|
PATH: /SECURITY.md
|
||||||
VERSION: 01.01.00
|
VERSION: 01.01.00
|
||||||
BRIEF: Security vulnerability reporting and handling policy
|
BRIEF: Security vulnerability reporting and handling policy
|
||||||
@@ -54,7 +54,7 @@ Report security vulnerabilities privately to:
|
|||||||
|
|
||||||
**Email**: `security@mokoconsulting.tech`
|
**Email**: `security@mokoconsulting.tech`
|
||||||
|
|
||||||
**Subject Line**: `[SECURITY] MokoStandards-Template-Joomla-Plugin - Brief Description`
|
**Subject Line**: `[SECURITY] Template-Joomla - Brief Description`
|
||||||
|
|
||||||
### What to Include
|
### What to Include
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ The following are explicitly out of scope:
|
|||||||
| ------------ | ------------------------------------------------------------------------------------------------------------ |
|
| ------------ | ------------------------------------------------------------------------------------------------------------ |
|
||||||
| Document | Security Policy |
|
| Document | Security Policy |
|
||||||
| Path | /SECURITY.md |
|
| Path | /SECURITY.md |
|
||||||
| Repository | [https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin](https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin) |
|
| Repository | [https://github.com/mokoconsulting-tech/Template-Joomla](https://github.com/mokoconsulting-tech/Template-Joomla) |
|
||||||
| Owner | Moko Consulting |
|
| Owner | Moko Consulting |
|
||||||
| Scope | Security vulnerability handling |
|
| Scope | Security vulnerability handling |
|
||||||
| Status | Active |
|
| Status | Active |
|
||||||
|
|||||||
@@ -1,237 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# ============================================================================
|
|
||||||
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
#
|
|
||||||
# FILE INFORMATION
|
|
||||||
# DEFGROUP: Automation.CI
|
|
||||||
# INGROUP: moko-platform.Automation
|
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
|
||||||
# PATH: /automation/ci-issue-reporter.sh
|
|
||||||
# VERSION: 09.23.00
|
|
||||||
# BRIEF: Creates or updates a Gitea issue when a CI gate fails.
|
|
||||||
# Deduplicates by searching open issues with the "ci-auto" label
|
|
||||||
# whose title matches the gate. If a matching issue exists, a comment
|
|
||||||
# is appended instead of opening a duplicate.
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# ── Defaults ────────────────────────────────────────────────────────────────
|
|
||||||
GITEA_URL="${GITEA_URL:-https://git.mokoconsulting.tech}"
|
|
||||||
GITEA_TOKEN="${GITEA_TOKEN:-}"
|
|
||||||
REPO="${GITHUB_REPOSITORY:-}"
|
|
||||||
RUN_URL="${GITHUB_SERVER_URL:-${GITEA_URL}}/${REPO}/actions/runs/${GITHUB_RUN_ID:-0}"
|
|
||||||
LABEL_NAME="ci-auto"
|
|
||||||
LABEL_COLOR="#e11d48"
|
|
||||||
|
|
||||||
GATE=""
|
|
||||||
DETAILS=""
|
|
||||||
SEVERITY="error"
|
|
||||||
WORKFLOW=""
|
|
||||||
|
|
||||||
# ── Parse arguments ─────────────────────────────────────────────────────────
|
|
||||||
usage() {
|
|
||||||
cat <<EOF
|
|
||||||
Usage: ci-issue-reporter.sh --gate NAME --details TEXT [OPTIONS]
|
|
||||||
|
|
||||||
Required:
|
|
||||||
--gate CI gate name (e.g. "Code Quality", "Self-Health")
|
|
||||||
--details Human-readable failure description
|
|
||||||
|
|
||||||
Optional:
|
|
||||||
--severity "error" (default) or "warning"
|
|
||||||
--workflow Workflow name for the issue title
|
|
||||||
--repo owner/repo (default: \$GITHUB_REPOSITORY)
|
|
||||||
--run-url URL to the CI run (auto-detected from env)
|
|
||||||
--token Gitea API token (default: \$GITEA_TOKEN)
|
|
||||||
--url Gitea base URL (default: \$GITEA_URL)
|
|
||||||
EOF
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case "$1" in
|
|
||||||
--gate) GATE="$2"; shift 2 ;;
|
|
||||||
--details) DETAILS="$2"; shift 2 ;;
|
|
||||||
--severity) SEVERITY="$2"; shift 2 ;;
|
|
||||||
--workflow) WORKFLOW="$2"; shift 2 ;;
|
|
||||||
--repo) REPO="$2"; shift 2 ;;
|
|
||||||
--run-url) RUN_URL="$2"; shift 2 ;;
|
|
||||||
--token) GITEA_TOKEN="$2"; shift 2 ;;
|
|
||||||
--url) GITEA_URL="$2"; shift 2 ;;
|
|
||||||
-h|--help) usage ;;
|
|
||||||
*) echo "Unknown option: $1"; usage ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
[[ -z "$GATE" ]] && { echo "ERROR: --gate is required"; usage; }
|
|
||||||
[[ -z "$DETAILS" ]] && { echo "ERROR: --details is required"; usage; }
|
|
||||||
[[ -z "$GITEA_TOKEN" ]] && { echo "ERROR: GITEA_TOKEN not set"; exit 1; }
|
|
||||||
[[ -z "$REPO" ]] && { echo "ERROR: GITHUB_REPOSITORY not set"; exit 1; }
|
|
||||||
|
|
||||||
API="${GITEA_URL}/api/v1/repos/${REPO}"
|
|
||||||
|
|
||||||
# ── Build title ─────────────────────────────────────────────────────────────
|
|
||||||
if [[ -n "$WORKFLOW" ]]; then
|
|
||||||
TITLE="[CI] ${WORKFLOW}: ${GATE} failed"
|
|
||||||
else
|
|
||||||
TITLE="[CI] ${GATE} failed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── Ensure label exists ─────────────────────────────────────────────────────
|
|
||||||
ensure_label() {
|
|
||||||
local exists
|
|
||||||
exists=$(curl -sf -o /dev/null -w '%{http_code}' \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
"${API}/labels" 2>/dev/null || echo "000")
|
|
||||||
|
|
||||||
if [[ "$exists" == "200" ]]; then
|
|
||||||
# Check if label already exists
|
|
||||||
local found
|
|
||||||
found=$(curl -sf \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
"${API}/labels" 2>/dev/null \
|
|
||||||
| grep -o "\"name\":\"${LABEL_NAME}\"" || true)
|
|
||||||
|
|
||||||
if [[ -z "$found" ]]; then
|
|
||||||
curl -sf -X POST \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
"${API}/labels" \
|
|
||||||
-d "{\"name\":\"${LABEL_NAME}\",\"color\":\"${LABEL_COLOR}\",\"description\":\"Auto-created by CI issue reporter\"}" \
|
|
||||||
> /dev/null 2>&1 || true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# ── Search for existing open issue ──────────────────────────────────────────
|
|
||||||
find_existing_issue() {
|
|
||||||
# URL-encode the gate name for the query
|
|
||||||
local query
|
|
||||||
query=$(printf '%s' "[CI] ${GATE}" | sed 's/ /%20/g; s/\[/%5B/g; s/\]/%5D/g')
|
|
||||||
|
|
||||||
local response
|
|
||||||
response=$(curl -sf \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
"${API}/issues?type=issues&state=open&labels=${LABEL_NAME}&q=${query}&limit=5" \
|
|
||||||
2>/dev/null || echo "[]")
|
|
||||||
|
|
||||||
# Extract the first matching issue number
|
|
||||||
echo "$response" \
|
|
||||||
| grep -oP '"number":\s*\K[0-9]+' \
|
|
||||||
| head -1
|
|
||||||
}
|
|
||||||
|
|
||||||
# ── Build issue body ────────────────────────────────────────────────────────
|
|
||||||
build_body() {
|
|
||||||
local severity_badge
|
|
||||||
if [[ "$SEVERITY" == "error" ]]; then
|
|
||||||
severity_badge="**Severity:** Error"
|
|
||||||
else
|
|
||||||
severity_badge="**Severity:** Warning"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<BODY
|
|
||||||
## CI Gate Failure: ${GATE}
|
|
||||||
|
|
||||||
${severity_badge}
|
|
||||||
**Workflow:** ${WORKFLOW:-unknown}
|
|
||||||
**Branch:** ${GITHUB_REF_NAME:-unknown}
|
|
||||||
**Commit:** \`${GITHUB_SHA:0:8}\`
|
|
||||||
**Run:** [View CI run](${RUN_URL})
|
|
||||||
|
|
||||||
### Details
|
|
||||||
|
|
||||||
${DETAILS}
|
|
||||||
|
|
||||||
### Resolution
|
|
||||||
|
|
||||||
Fix the issue described above and push a new commit. This issue will be closed automatically when the gate passes, or can be closed manually.
|
|
||||||
|
|
||||||
---
|
|
||||||
*Auto-created by [ci-issue-reporter](${GITEA_URL}/${REPO}/src/branch/main/automation/ci-issue-reporter.sh)*
|
|
||||||
BODY
|
|
||||||
}
|
|
||||||
|
|
||||||
# ── Build comment body (for existing issues) ────────────────────────────────
|
|
||||||
build_comment() {
|
|
||||||
cat <<COMMENT
|
|
||||||
### CI failure recurrence
|
|
||||||
|
|
||||||
**Branch:** ${GITHUB_REF_NAME:-unknown}
|
|
||||||
**Commit:** \`${GITHUB_SHA:0:8}\`
|
|
||||||
**Run:** [View CI run](${RUN_URL})
|
|
||||||
|
|
||||||
${DETAILS}
|
|
||||||
COMMENT
|
|
||||||
}
|
|
||||||
|
|
||||||
# ── Main ────────────────────────────────────────────────────────────────────
|
|
||||||
ensure_label
|
|
||||||
|
|
||||||
EXISTING=$(find_existing_issue)
|
|
||||||
|
|
||||||
if [[ -n "$EXISTING" ]]; then
|
|
||||||
# Append comment to existing issue
|
|
||||||
COMMENT_BODY=$(build_comment)
|
|
||||||
COMMENT_JSON=$(printf '%s' "$COMMENT_BODY" | python3 -c "
|
|
||||||
import sys, json
|
|
||||||
print(json.dumps({'body': sys.stdin.read()}))" 2>/dev/null)
|
|
||||||
|
|
||||||
HTTP=$(curl -sf -o /dev/null -w '%{http_code}' -X POST \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
"${API}/issues/${EXISTING}/comments" \
|
|
||||||
-d "${COMMENT_JSON}" 2>/dev/null || echo "000")
|
|
||||||
|
|
||||||
if [[ "$HTTP" == "201" ]]; then
|
|
||||||
echo "Commented on existing issue #${EXISTING}"
|
|
||||||
else
|
|
||||||
echo "WARNING: Failed to comment on issue #${EXISTING} (HTTP ${HTTP})"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Create new issue
|
|
||||||
ISSUE_BODY=$(build_body)
|
|
||||||
ISSUE_JSON=$(python3 -c "
|
|
||||||
import sys, json
|
|
||||||
body = sys.stdin.read()
|
|
||||||
print(json.dumps({
|
|
||||||
'title': sys.argv[1],
|
|
||||||
'body': body,
|
|
||||||
'labels': []
|
|
||||||
}))" "$TITLE" <<< "$ISSUE_BODY" 2>/dev/null)
|
|
||||||
|
|
||||||
# Create the issue
|
|
||||||
RESPONSE=$(curl -sf -X POST \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
"${API}/issues" \
|
|
||||||
-d "${ISSUE_JSON}" 2>/dev/null || echo "{}")
|
|
||||||
|
|
||||||
ISSUE_NUM=$(echo "$RESPONSE" | grep -oP '"number":\s*\K[0-9]+' | head -1)
|
|
||||||
|
|
||||||
if [[ -n "$ISSUE_NUM" ]]; then
|
|
||||||
# Apply label (separate call — more reliable across Gitea versions)
|
|
||||||
LABEL_ID=$(curl -sf \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
"${API}/labels" 2>/dev/null \
|
|
||||||
| grep -oP "\"id\":\s*\K[0-9]+(?=[^}]*\"name\":\s*\"${LABEL_NAME}\")" \
|
|
||||||
| head -1 || true)
|
|
||||||
|
|
||||||
if [[ -n "$LABEL_ID" ]]; then
|
|
||||||
curl -sf -X POST \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
"${API}/issues/${ISSUE_NUM}/labels" \
|
|
||||||
-d "{\"labels\":[${LABEL_ID}]}" \
|
|
||||||
> /dev/null 2>&1 || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Created issue #${ISSUE_NUM}: ${TITLE}"
|
|
||||||
else
|
|
||||||
echo "WARNING: Failed to create issue"
|
|
||||||
echo "Response: ${RESPONSE}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="component" method="upgrade">
|
||||||
|
<name>Moko Component</name>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<creationDate>July 2026</creationDate>
|
||||||
|
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GNU General Public License version 3 or later; see LICENSE</license>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<description>A premium core business engine component engineered by Moko Consulting for Joomla 6 platform solutions.</description>
|
||||||
|
|
||||||
|
<namespace path="src">MokoConsulting\Component\MyExtension</namespace>
|
||||||
|
|
||||||
|
<files folder="site">
|
||||||
|
<folder>src</folder>
|
||||||
|
<folder>tmpl</folder>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<media destination="com_myextension" folder="media">
|
||||||
|
<filename>joomla.asset.json</filename>
|
||||||
|
<folder>css</folder>
|
||||||
|
<folder>js</folder>
|
||||||
|
</media>
|
||||||
|
|
||||||
|
<administration>
|
||||||
|
<menu link="option=com_myextension">Moko Component</menu>
|
||||||
|
<files folder="admin">
|
||||||
|
<folder>services</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
<folder>tmpl</folder>
|
||||||
|
<filename>myextension.xml</filename>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<languages folder="admin">
|
||||||
|
<language tag="en-GB">language/en-GB/com_myextension.ini</language>
|
||||||
|
<language tag="en-GB">language/en-GB/com_myextension.sys.ini</language>
|
||||||
|
<language tag="en-US">language/en-US/com_myextension.ini</language>
|
||||||
|
<language tag="en-US">language/en-US/com_myextension.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
</administration>
|
||||||
|
|
||||||
|
<updateservers>
|
||||||
|
<server type="extension" priority="1" name="Moko Consulting Updates" dlid="id">
|
||||||
|
https://update.mokoconsulting.tech/com_myextension.xml
|
||||||
|
</server>
|
||||||
|
</updateservers>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="library" method="upgrade">
|
||||||
|
<name>Moko Shared Core Library</name>
|
||||||
|
<libraryname>mokolibrary</libraryname>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<creationDate>July 2026</creationDate>
|
||||||
|
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GNU General Public License version 3 or later; see LICENSE</license>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<description>Centralized helper framework and base API abstraction wrappers used across all active Moko Consulting extension matrices.</description>
|
||||||
|
|
||||||
|
<namespace path="src">MokoConsulting\Library\MokoLibrary</namespace>
|
||||||
|
|
||||||
|
<files>
|
||||||
|
<folder>src</folder>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<languages>
|
||||||
|
<language tag="en-GB">language/en-GB/lib_mokolibrary.sys.ini</language>
|
||||||
|
<language tag="en-US">language/en-US/lib_mokolibrary.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
|
||||||
|
<updateservers>
|
||||||
|
<server type="extension" priority="1" name="Moko Consulting Updates" dlid="id">
|
||||||
|
https://update.mokoconsulting.tech/lib_mokolibrary.xml
|
||||||
|
</server>
|
||||||
|
</updateservers>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="module" client="site" method="upgrade">
|
||||||
|
<name>Moko Dynamic Content Showcase</name>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<creationDate>July 2026</creationDate>
|
||||||
|
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GNU General Public License version 3 or later; see LICENSE</license>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<description>A high-performance asynchronous frontend display module designed to cleanly inject dynamic layout matrices into module zones.</description>
|
||||||
|
|
||||||
|
<namespace path="src">MokoConsulting\Module\MokoModule</namespace>
|
||||||
|
|
||||||
|
<files>
|
||||||
|
<folder module="mod_mokomodule">services</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
<folder>tmpl</folder>
|
||||||
|
<filename>mod_mokomodule.xml</filename>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<languages>
|
||||||
|
<language tag="en-GB">language/en-GB/mod_mokomodule.ini</language>
|
||||||
|
<language tag="en-GB">language/en-GB/mod_mokomodule.sys.ini</language>
|
||||||
|
<language tag="en-US">language/en-US/mod_mokomodule.ini</language>
|
||||||
|
<language tag="en-US">language/en-US/mod_mokomodule.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
|
||||||
|
<config>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset name="basic">
|
||||||
|
<field name="layout" type="modulelayout" label="Select Layout File" />
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</config>
|
||||||
|
|
||||||
|
<updateservers>
|
||||||
|
<server type="extension" priority="1" name="Moko Consulting Updates" dlid="id">
|
||||||
|
https://update.mokoconsulting.tech/mod_mokomodule.xml
|
||||||
|
</server>
|
||||||
|
</updateservers>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="package" method="upgrade">
|
||||||
|
<name>Moko Full Suite Package</name>
|
||||||
|
<packagename>mokopackage</packagename>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<creationDate>July 2026</creationDate>
|
||||||
|
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GNU General Public License version 3 or later; see LICENSE</license>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<description>All-in-one distribution bundle wrapping the Moko Component, Dynamic Showcase Module, and System Interceptor Plugin into a single installation step.</description>
|
||||||
|
|
||||||
|
<languages>
|
||||||
|
<language tag="en-GB">en-GB.pkg_mokopackage.sys.ini</language>
|
||||||
|
<language tag="en-US">en-US.pkg_mokopackage.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
|
||||||
|
<files folder="constituents">
|
||||||
|
<file type="component" id="com_myextension">com_myextension.zip</file>
|
||||||
|
<file type="module" id="mod_mokomodule" client="site">mod_mokomodule.zip</file>
|
||||||
|
<file type="plugin" id="mokoplugin" group="system">plg_system_mokoplugin.zip</file>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<updateservers>
|
||||||
|
<server type="collection" priority="1" name="Moko Consulting Updates" dlid="id">
|
||||||
|
https://update.mokoconsulting.tech/pkg_mokopackage.xml
|
||||||
|
</server>
|
||||||
|
</updateservers>
|
||||||
|
|
||||||
|
<blockChildUninstall>1</blockChildUninstall>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="plugin" group="system" method="upgrade">
|
||||||
|
<name>System - Moko Automation Plugin</name>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<creationDate>July 2026</creationDate>
|
||||||
|
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GNU General Public License version 3 or later; see LICENSE</license>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<description>Advanced system-level interceptor framework developed by Moko Consulting for request optimizations in Joomla 6.</description>
|
||||||
|
|
||||||
|
<namespace path="src">MokoConsulting\Plugin\System\MokoPlugin</namespace>
|
||||||
|
|
||||||
|
<files>
|
||||||
|
<folder plugin="mokoplugin">services</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<languages>
|
||||||
|
<language tag="en-GB">language/en-GB/plg_system_mokoplugin.ini</language>
|
||||||
|
<language tag="en-GB">language/en-GB/plg_system_mokoplugin.sys.ini</language>
|
||||||
|
<language tag="en-US">language/en-US/plg_system_mokoplugin.ini</language>
|
||||||
|
<language tag="en-US">language/en-US/plg_system_mokoplugin.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
|
||||||
|
<config>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset name="basic">
|
||||||
|
<field name="example_param" type="text" label="API Endpoint Parameter" />
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</config>
|
||||||
|
|
||||||
|
<updateservers>
|
||||||
|
<server type="extension" priority="1" name="Moko Consulting Updates" dlid="id">
|
||||||
|
https://update.mokoconsulting.tech/plg_system_mokoplugin.xml
|
||||||
|
</server>
|
||||||
|
</updateservers>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="template" client="site" method="upgrade">
|
||||||
|
<name>tpl_mokotemplate</name>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<creationDate>July 2026</creationDate>
|
||||||
|
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GNU General Public License version 3 or later; see LICENSE</license>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<description>Moko Corporate Template - A modern, high-performance responsive frontend design system for Joomla 6.</description>
|
||||||
|
|
||||||
|
<files>
|
||||||
|
<filename>templateDetails.xml</filename>
|
||||||
|
<filename>index.php</filename>
|
||||||
|
<filename>template_thumbnail.png</filename>
|
||||||
|
<filename>template_preview.png</filename>
|
||||||
|
<folder>css</folder>
|
||||||
|
<folder>js</folder>
|
||||||
|
<folder>images</folder>
|
||||||
|
<folder>html</folder>
|
||||||
|
<folder>language</folder>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<positions>
|
||||||
|
<position>topbar</position>
|
||||||
|
<position>header</position>
|
||||||
|
<position>menu</position>
|
||||||
|
<position>breadcrumbs</position>
|
||||||
|
<position>sidebar-left</position>
|
||||||
|
<position>sidebar-right</position>
|
||||||
|
<position>main-top</position>
|
||||||
|
<position>main-bottom</position>
|
||||||
|
<position>footer</position>
|
||||||
|
</positions>
|
||||||
|
|
||||||
|
<languages folder="language">
|
||||||
|
<language tag="en-GB">en-GB/tpl_mokotemplate.ini</language>
|
||||||
|
<language tag="en-GB">en-GB/tpl_mokotemplate.sys.ini</language>
|
||||||
|
<language tag="en-US">en-US/tpl_mokotemplate.ini</language>
|
||||||
|
<language tag="en-US">en-US/tpl_mokotemplate.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
|
||||||
|
<config>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset name="basic" label="Basic Parameters">
|
||||||
|
<field name="logo" type="media" label="Select Corporate Logo" />
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</config>
|
||||||
|
|
||||||
|
<updateservers>
|
||||||
|
<server type="extension" priority="1" name="Moko Consulting Updates" dlid="id">
|
||||||
|
https://update.mokoconsulting.tech/tpl_mokotemplate.xml
|
||||||
|
</server>
|
||||||
|
</updateservers>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ============================================================================
|
||||||
|
* INSTRUCTIONS FOR USE:
|
||||||
|
* 1. This file template serves as the standard structure for all script files
|
||||||
|
* across the extension repositories. Copy and implement this pattern
|
||||||
|
* universally in every script file to maintain consistency.
|
||||||
|
* 2. Replace '{REPONAME}' with the actual name of the repo (UPPERCASE).
|
||||||
|
* Example: "MOKOSUITEBACKUP"
|
||||||
|
* 3. Replace '{PACKAGENAME}' with the Joomla extension element name (lowercase).
|
||||||
|
* Example: "pkg_mokosuitebackup", "com_mokosuitebackup", "mod_mokosuitebackup"
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package Joomla.Installer
|
||||||
|
* @subpackage {PACKAGENAME}
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Log\Log;
|
||||||
|
|
||||||
|
defined('_JEXEC') || die;
|
||||||
|
|
||||||
|
class ComponentInstallerScript
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string The saved download key cached during preflight to survive updates
|
||||||
|
*/
|
||||||
|
private $savedDownloadKey = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preflight hook runs before any installation/update/uninstallation action.
|
||||||
|
*/
|
||||||
|
public function preflight($type, $parent): bool
|
||||||
|
{
|
||||||
|
if ($type === 'update') {
|
||||||
|
$this->backupDownloadKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Postflight hook runs after any installation/update/uninstallation action.
|
||||||
|
*/
|
||||||
|
public function postflight($type, $parent): void
|
||||||
|
{
|
||||||
|
if ($type === 'install') {
|
||||||
|
$this->installSuccessful();
|
||||||
|
$this->warnMissingLicenseKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === 'update') {
|
||||||
|
$this->restoreDownloadKey();
|
||||||
|
$this->installSuccessful();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function install($parent): void {}
|
||||||
|
public function update($parent): void {}
|
||||||
|
public function uninstall($parent): void {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache the existing download key from the update sites table before update runs.
|
||||||
|
*/
|
||||||
|
private function backupDownloadKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('us.extra_query'))
|
||||||
|
->from($db->quoteName('#__update_sites', 'us'))
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__update_sites_extensions', 'use')
|
||||||
|
. ' ON ' . $db->quoteName('use.update_site_id') . ' = ' . $db->quoteName('us.update_site_id')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__extensions', 'e')
|
||||||
|
. ' ON ' . $db->quoteName('e.extension_id') . ' = ' . $db->quoteName('use.extension_id')
|
||||||
|
)
|
||||||
|
->where($db->quoteName('e.element') . ' = ' . $db->quote('{PACKAGENAME}'))
|
||||||
|
->where($db->quoteName('e.type') . ' = ' . $db->quote('component'))
|
||||||
|
->setLimit(1);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$extraQuery = (string) $db->loadResult();
|
||||||
|
|
||||||
|
if (!empty($extraQuery)) {
|
||||||
|
parse_str($extraQuery, $output);
|
||||||
|
$this->savedDownloadKey = $output['dlid'] ?? $extraQuery;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::add('{REPONAME}: Could not backup download key: ' . $e->getMessage(), Log::WARNING, 'jerror');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore the download key to the (possibly new) update site record.
|
||||||
|
*/
|
||||||
|
private function restoreDownloadKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('us.update_site_id'))
|
||||||
|
->from($db->quoteName('#__update_sites', 'us'))
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__update_sites_extensions', 'use')
|
||||||
|
. ' ON ' . $db->quoteName('use.update_site_id') . ' = ' . $db->quoteName('us.update_site_id')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__extensions', 'e')
|
||||||
|
. ' ON ' . $db->quoteName('e.extension_id') . ' = ' . $db->quoteName('use.extension_id')
|
||||||
|
)
|
||||||
|
->where($db->quoteName('e.element') . ' = ' . $db->quote('{PACKAGENAME}'))
|
||||||
|
->where($db->quoteName('e.type') . ' = ' . $db->quote('component'))
|
||||||
|
->setLimit(1);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$updateSiteId = (int) $db->loadResult();
|
||||||
|
|
||||||
|
if ($updateSiteId > 0 && !empty($this->savedDownloadKey)) {
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->update($db->quoteName('#__update_sites'))
|
||||||
|
->set($db->quoteName('extra_query') . ' = ' . $db->quote('dlid=' . $this->savedDownloadKey))
|
||||||
|
->where($db->quoteName('update_site_id') . ' = ' . $updateSiteId);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::add('{REPONAME}: Could not restore download key: ' . $e->getMessage(), Log::WARNING, 'jerror');
|
||||||
|
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME}</h4>'
|
||||||
|
. '<p>Your download/license key could not be preserved during the update.</p>'
|
||||||
|
. '<p>Please re-enter it in the <a class="btn btn-sm btn-warning ms-2" href="index.php?option=com_installer&view=updatesites&filter[search]={PACKAGENAME}">Update Sites</a> manager to continue receiving updates.</p>',
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show post-install license key prompt
|
||||||
|
*/
|
||||||
|
private function warnMissingLicenseKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME} License Key Required</h4>'
|
||||||
|
. '<p>A download/license key (DLID) is required to receive updates.</p>'
|
||||||
|
. '<p>Enter your key in the <a class="btn btn-sm btn-warning ms-2" href="index.php?option=com_installer&view=updatesites&filter[search]={PACKAGENAME}">Update Sites</a> manager '
|
||||||
|
. 'or contact <a class="btn btn-sm btn-warning ms-2" href="https://mokoconsulting.tech/support" target="_blank" rel="noopener">Moko Consulting Support</a> to obtain one.</p>',
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show install successful prompt
|
||||||
|
*/
|
||||||
|
private function installSuccessful(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME} installed successfully!</h4>',
|
||||||
|
'info'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ============================================================================
|
||||||
|
* INSTRUCTIONS FOR USE:
|
||||||
|
* 1. This file template serves as the standard structure for all script files
|
||||||
|
* across the extension repositories. Copy and implement this pattern
|
||||||
|
* universally in every script file to maintain consistency.
|
||||||
|
* 2. Replace '{REPONAME}' with the actual name of the repo (UPPERCASE).
|
||||||
|
* Example: "MOKOSUITEBACKUP"
|
||||||
|
* 3. Replace '{PACKAGENAME}' with the Joomla extension element name (lowercase).
|
||||||
|
* Example: "pkg_mokosuitebackup", "com_mokosuitebackup", "mod_mokosuitebackup"
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package Joomla.Installer
|
||||||
|
* @subpackage {PACKAGENAME}
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Log\Log;
|
||||||
|
|
||||||
|
defined('_JEXEC') || die;
|
||||||
|
|
||||||
|
class ModuleInstallerScript
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string The saved download key cached during preflight to survive updates
|
||||||
|
*/
|
||||||
|
private $savedDownloadKey = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preflight hook runs before any installation/update/uninstallation action.
|
||||||
|
*/
|
||||||
|
public function preflight($type, $parent): bool
|
||||||
|
{
|
||||||
|
if ($type === 'update') {
|
||||||
|
$this->backupDownloadKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Postflight hook runs after any installation/update/uninstallation action.
|
||||||
|
*/
|
||||||
|
public function postflight($type, $parent): void
|
||||||
|
{
|
||||||
|
if ($type === 'install') {
|
||||||
|
$this->installSuccessful();
|
||||||
|
$this->warnMissingLicenseKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === 'update') {
|
||||||
|
$this->restoreDownloadKey();
|
||||||
|
$this->installSuccessful();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function install($parent): void {}
|
||||||
|
public function update($parent): void {}
|
||||||
|
public function uninstall($parent): void {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache the existing download key from the update sites table before update runs.
|
||||||
|
*/
|
||||||
|
private function backupDownloadKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('us.extra_query'))
|
||||||
|
->from($db->quoteName('#__update_sites', 'us'))
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__update_sites_extensions', 'use')
|
||||||
|
. ' ON ' . $db->quoteName('use.update_site_id') . ' = ' . $db->quoteName('us.update_site_id')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__extensions', 'e')
|
||||||
|
. ' ON ' . $db->quoteName('e.extension_id') . ' = ' . $db->quoteName('use.extension_id')
|
||||||
|
)
|
||||||
|
->where($db->quoteName('e.element') . ' = ' . $db->quote('{PACKAGENAME}'))
|
||||||
|
->where($db->quoteName('e.type') . ' = ' . $db->quote('module'))
|
||||||
|
->setLimit(1);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$extraQuery = (string) $db->loadResult();
|
||||||
|
|
||||||
|
if (!empty($extraQuery)) {
|
||||||
|
parse_str($extraQuery, $output);
|
||||||
|
$this->savedDownloadKey = $output['dlid'] ?? $extraQuery;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::add('{REPONAME}: Could not backup download key: ' . $e->getMessage(), Log::WARNING, 'jerror');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore the download key to the (possibly new) update site record.
|
||||||
|
*/
|
||||||
|
private function restoreDownloadKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('us.update_site_id'))
|
||||||
|
->from($db->quoteName('#__update_sites', 'us'))
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__update_sites_extensions', 'use')
|
||||||
|
. ' ON ' . $db->quoteName('use.update_site_id') . ' = ' . $db->quoteName('us.update_site_id')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__extensions', 'e')
|
||||||
|
. ' ON ' . $db->quoteName('e.extension_id') . ' = ' . $db->quoteName('use.extension_id')
|
||||||
|
)
|
||||||
|
->where($db->quoteName('e.element') . ' = ' . $db->quote('{PACKAGENAME}'))
|
||||||
|
->where($db->quoteName('e.type') . ' = ' . $db->quote('module'))
|
||||||
|
->setLimit(1);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$updateSiteId = (int) $db->loadResult();
|
||||||
|
|
||||||
|
if ($updateSiteId > 0 && !empty($this->savedDownloadKey)) {
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->update($db->quoteName('#__update_sites'))
|
||||||
|
->set($db->quoteName('extra_query') . ' = ' . $db->quote('dlid=' . $this->savedDownloadKey))
|
||||||
|
->where($db->quoteName('update_site_id') . ' = ' . $updateSiteId);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::add('{REPONAME}: Could not restore download key: ' . $e->getMessage(), Log::WARNING, 'jerror');
|
||||||
|
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME}</h4>'
|
||||||
|
. '<p>Your download/license key could not be preserved during the update.</p>'
|
||||||
|
. '<p>Please re-enter it in the <a class="btn btn-sm btn-warning ms-2" href="index.php?option=com_installer&view=updatesites&filter[search]={PACKAGENAME}">Update Sites</a> manager to continue receiving updates.</p>',
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show post-install license key prompt
|
||||||
|
*/
|
||||||
|
private function warnMissingLicenseKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME} License Key Required</h4>'
|
||||||
|
. '<p>A download/license key (DLID) is required to receive updates.</p>'
|
||||||
|
. '<p>Enter your key in the <a class="btn btn-sm btn-warning ms-2" href="index.php?option=com_installer&view=updatesites&filter[search]={PACKAGENAME}">Update Sites</a> manager '
|
||||||
|
. 'or contact <a class="btn btn-sm btn-warning ms-2" href="https://mokoconsulting.tech/support" target="_blank" rel="noopener">Moko Consulting Support</a> to obtain one.</p>',
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show install successful prompt
|
||||||
|
*/
|
||||||
|
private function installSuccessful(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME} installed successfully!</h4>',
|
||||||
|
'info'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ============================================================================
|
||||||
|
* INSTRUCTIONS FOR USE:
|
||||||
|
* 1. This file template serves as the standard structure for all script files
|
||||||
|
* across the extension repositories. Copy and implement this pattern
|
||||||
|
* universally in every script file to maintain consistency.
|
||||||
|
* 2. Replace '{REPONAME}' with the actual name of the repo (UPPERCASE).
|
||||||
|
* Example: "MOKOSUITEBACKUP"
|
||||||
|
* 3. Replace '{PACKAGENAME}' with the Joomla extension element name (lowercase).
|
||||||
|
* Example: "pkg_mokosuitebackup", "com_mokosuitebackup", "mod_mokosuitebackup"
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package Joomla.Installer
|
||||||
|
* @subpackage {PACKAGENAME}
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Log\Log;
|
||||||
|
|
||||||
|
defined('_JEXEC') || die;
|
||||||
|
|
||||||
|
class PackageInstallerScript
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string The saved download key cached during preflight to survive updates
|
||||||
|
*/
|
||||||
|
private $savedDownloadKey = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preflight hook runs before any installation/update/uninstallation action.
|
||||||
|
*/
|
||||||
|
public function preflight($type, $parent): bool
|
||||||
|
{
|
||||||
|
if ($type === 'update') {
|
||||||
|
$this->backupDownloadKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Postflight hook runs after any installation/update/uninstallation action.
|
||||||
|
*/
|
||||||
|
public function postflight($type, $parent): void
|
||||||
|
{
|
||||||
|
if ($type === 'install') {
|
||||||
|
$this->installSuccessful();
|
||||||
|
$this->warnMissingLicenseKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === 'update') {
|
||||||
|
$this->restoreDownloadKey();
|
||||||
|
$this->installSuccessful();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function install($parent): void {}
|
||||||
|
public function update($parent): void {}
|
||||||
|
public function uninstall($parent): void {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache the existing download key from the update sites table before update runs.
|
||||||
|
*/
|
||||||
|
private function backupDownloadKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('us.extra_query'))
|
||||||
|
->from($db->quoteName('#__update_sites', 'us'))
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__update_sites_extensions', 'use')
|
||||||
|
. ' ON ' . $db->quoteName('use.update_site_id') . ' = ' . $db->quoteName('us.update_site_id')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__extensions', 'e')
|
||||||
|
. ' ON ' . $db->quoteName('e.extension_id') . ' = ' . $db->quoteName('use.extension_id')
|
||||||
|
)
|
||||||
|
->where($db->quoteName('e.element') . ' = ' . $db->quote('{PACKAGENAME}'))
|
||||||
|
->where($db->quoteName('e.type') . ' = ' . $db->quote('package'))
|
||||||
|
->setLimit(1);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$extraQuery = (string) $db->loadResult();
|
||||||
|
|
||||||
|
if (!empty($extraQuery)) {
|
||||||
|
parse_str($extraQuery, $output);
|
||||||
|
$this->savedDownloadKey = $output['dlid'] ?? $extraQuery;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::add('{REPONAME}: Could not backup download key: ' . $e->getMessage(), Log::WARNING, 'jerror');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore the download key to the (possibly new) update site record.
|
||||||
|
*/
|
||||||
|
private function restoreDownloadKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('us.update_site_id'))
|
||||||
|
->from($db->quoteName('#__update_sites', 'us'))
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__update_sites_extensions', 'use')
|
||||||
|
. ' ON ' . $db->quoteName('use.update_site_id') . ' = ' . $db->quoteName('us.update_site_id')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__extensions', 'e')
|
||||||
|
. ' ON ' . $db->quoteName('e.extension_id') . ' = ' . $db->quoteName('use.extension_id')
|
||||||
|
)
|
||||||
|
->where($db->quoteName('e.element') . ' = ' . $db->quote('{PACKAGENAME}'))
|
||||||
|
->where($db->quoteName('e.type') . ' = ' . $db->quote('package'))
|
||||||
|
->setLimit(1);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$updateSiteId = (int) $db->loadResult();
|
||||||
|
|
||||||
|
if ($updateSiteId > 0 && !empty($this->savedDownloadKey)) {
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->update($db->quoteName('#__update_sites'))
|
||||||
|
->set($db->quoteName('extra_query') . ' = ' . $db->quote('dlid=' . $this->savedDownloadKey))
|
||||||
|
->where($db->quoteName('update_site_id') . ' = ' . $updateSiteId);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::add('{REPONAME}: Could not restore download key: ' . $e->getMessage(), Log::WARNING, 'jerror');
|
||||||
|
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME}</h4>'
|
||||||
|
. '<p>Your download/license key could not be preserved during the update.</p>'
|
||||||
|
. '<p>Please re-enter it in the <a class="btn btn-sm btn-warning ms-2" href="index.php?option=com_installer&view=updatesites&filter[search]={PACKAGENAME}">Update Sites</a> manager to continue receiving updates.</p>',
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show post-install license key prompt
|
||||||
|
*/
|
||||||
|
private function warnMissingLicenseKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME} License Key Required</h4>'
|
||||||
|
. '<p>A download/license key (DLID) is required to receive updates.</p>'
|
||||||
|
. '<p>Enter your key in the <a class="btn btn-sm btn-warning ms-2" href="index.php?option=com_installer&view=updatesites&filter[search]={PACKAGENAME}">Update Sites</a> manager '
|
||||||
|
. 'or contact <a class="btn btn-sm btn-warning ms-2" href="https://mokoconsulting.tech/support" target="_blank" rel="noopener">Moko Consulting Support</a> to obtain one.</p>',
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show install successful prompt
|
||||||
|
*/
|
||||||
|
private function installSuccessful(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME} installed successfully!</h4>',
|
||||||
|
'info'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ============================================================================
|
||||||
|
* INSTRUCTIONS FOR USE:
|
||||||
|
* 1. This file template serves as the standard structure for all script files
|
||||||
|
* across the extension repositories. Copy and implement this pattern
|
||||||
|
* universally in every script file to maintain consistency.
|
||||||
|
* 2. Replace '{REPONAME}' with the actual name of the repo (UPPERCASE).
|
||||||
|
* Example: "MOKOSUITEBACKUP"
|
||||||
|
* 3. Replace '{PACKAGENAME}' with the Joomla extension element name (lowercase).
|
||||||
|
* Example: "pkg_mokosuitebackup", "com_mokosuitebackup", "mod_mokosuitebackup"
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package Joomla.Installer
|
||||||
|
* @subpackage {PACKAGENAME}
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Log\Log;
|
||||||
|
|
||||||
|
defined('_JEXEC') || die;
|
||||||
|
|
||||||
|
class PluginInstallerScript
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string The saved download key cached during preflight to survive updates
|
||||||
|
*/
|
||||||
|
private $savedDownloadKey = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preflight hook runs before any installation/update/uninstallation action.
|
||||||
|
*/
|
||||||
|
public function preflight($type, $parent): bool
|
||||||
|
{
|
||||||
|
if ($type === 'update') {
|
||||||
|
$this->backupDownloadKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Postflight hook runs after any installation/update/uninstallation action.
|
||||||
|
*/
|
||||||
|
public function postflight($type, $parent): void
|
||||||
|
{
|
||||||
|
if ($type === 'install') {
|
||||||
|
$this->installSuccessful();
|
||||||
|
$this->warnMissingLicenseKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === 'update') {
|
||||||
|
$this->restoreDownloadKey();
|
||||||
|
$this->installSuccessful();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function install($parent): void {}
|
||||||
|
public function update($parent): void {}
|
||||||
|
public function uninstall($parent): void {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache the existing download key from the update sites table before update runs.
|
||||||
|
*/
|
||||||
|
private function backupDownloadKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('us.extra_query'))
|
||||||
|
->from($db->quoteName('#__update_sites', 'us'))
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__update_sites_extensions', 'use')
|
||||||
|
. ' ON ' . $db->quoteName('use.update_site_id') . ' = ' . $db->quoteName('us.update_site_id')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__extensions', 'e')
|
||||||
|
. ' ON ' . $db->quoteName('e.extension_id') . ' = ' . $db->quoteName('use.extension_id')
|
||||||
|
)
|
||||||
|
->where($db->quoteName('e.element') . ' = ' . $db->quote('{PACKAGENAME}'))
|
||||||
|
->where($db->quoteName('e.type') . ' = ' . $db->quote('plugin'))
|
||||||
|
->setLimit(1);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$extraQuery = (string) $db->loadResult();
|
||||||
|
|
||||||
|
if (!empty($extraQuery)) {
|
||||||
|
parse_str($extraQuery, $output);
|
||||||
|
$this->savedDownloadKey = $output['dlid'] ?? $extraQuery;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::add('{REPONAME}: Could not backup download key: ' . $e->getMessage(), Log::WARNING, 'jerror');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore the download key to the (possibly new) update site record.
|
||||||
|
*/
|
||||||
|
private function restoreDownloadKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('us.update_site_id'))
|
||||||
|
->from($db->quoteName('#__update_sites', 'us'))
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__update_sites_extensions', 'use')
|
||||||
|
. ' ON ' . $db->quoteName('use.update_site_id') . ' = ' . $db->quoteName('us.update_site_id')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
'INNER',
|
||||||
|
$db->quoteName('#__extensions', 'e')
|
||||||
|
. ' ON ' . $db->quoteName('e.extension_id') . ' = ' . $db->quoteName('use.extension_id')
|
||||||
|
)
|
||||||
|
->where($db->quoteName('e.element') . ' = ' . $db->quote('{PACKAGENAME}'))
|
||||||
|
->where($db->quoteName('e.type') . ' = ' . $db->quote('plugin'))
|
||||||
|
->setLimit(1);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$updateSiteId = (int) $db->loadResult();
|
||||||
|
|
||||||
|
if ($updateSiteId > 0 && !empty($this->savedDownloadKey)) {
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->update($db->quoteName('#__update_sites'))
|
||||||
|
->set($db->quoteName('extra_query') . ' = ' . $db->quote('dlid=' . $this->savedDownloadKey))
|
||||||
|
->where($db->quoteName('update_site_id') . ' = ' . $updateSiteId);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::add('{REPONAME}: Could not restore download key: ' . $e->getMessage(), Log::WARNING, 'jerror');
|
||||||
|
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME}</h4>'
|
||||||
|
. '<p>Your download/license key could not be preserved during the update.</p>'
|
||||||
|
. '<p>Please re-enter it in the <a class="btn btn-sm btn-warning ms-2" href="index.php?option=com_installer&view=updatesites&filter[search]={PACKAGENAME}">Update Sites</a> manager to continue receiving updates.</p>',
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show post-install license key prompt
|
||||||
|
*/
|
||||||
|
private function warnMissingLicenseKey(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME} License Key Required</h4>'
|
||||||
|
. '<p>A download/license key (DLID) is required to receive updates.</p>'
|
||||||
|
. '<p>Enter your key in the <a class="btn btn-sm btn-warning ms-2" href="index.php?option=com_installer&view=updatesites&filter[search]={PACKAGENAME}">Update Sites</a> manager '
|
||||||
|
. 'or contact <a class="btn btn-sm btn-warning ms-2" href="https://mokoconsulting.tech/support" target="_blank" rel="noopener">Moko Consulting Support</a> to obtain one.</p>',
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show install successful prompt
|
||||||
|
*/
|
||||||
|
private function installSuccessful(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Factory::getApplication()->enqueueMessage(
|
||||||
|
'<h4>{REPONAME} installed successfully!</h4>',
|
||||||
|
'info'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# Component Scaffold
|
|
||||||
|
|
||||||
Copy this directory as the starting point for a new Joomla component.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# Library Scaffold
|
|
||||||
|
|
||||||
Copy this directory as the starting point for a new Joomla library.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# Module Scaffold
|
|
||||||
|
|
||||||
Copy this directory as the starting point for a new Joomla module.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# Package Scaffold
|
|
||||||
|
|
||||||
Copy this directory as the starting point for a new Joomla package.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# Plugin Scaffold
|
|
||||||
|
|
||||||
Copy this directory as the starting point for a new Joomla plugin.
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
# Template Scaffold
|
|
||||||
|
|
||||||
Copy this directory as the starting point for a new Joomla site template.
|
|
||||||
Includes: index.php, error.php, offline.php, templateDetails.xml, css/, js/, fonts/, images/, html/
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* Custom CSS for yourtemplate
|
|
||||||
*
|
|
||||||
* This file is for user customizations.
|
|
||||||
* It will not be overwritten during template updates.
|
|
||||||
*
|
|
||||||
* @package Joomla.Site
|
|
||||||
* @subpackage Templates.yourtemplate
|
|
||||||
* @copyright Copyright (C) 2026. All rights reserved.
|
|
||||||
* @license GNU General Public License version 2 or later
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Add your custom styles below this line */
|
|
||||||
@@ -1,591 +0,0 @@
|
|||||||
/**
|
|
||||||
* Template CSS for yourtemplate
|
|
||||||
*
|
|
||||||
* This file contains all template styles in one place for simplicity.
|
|
||||||
* For larger projects, consider splitting into modular files:
|
|
||||||
* - base.css (resets, typography, base elements)
|
|
||||||
* - layout.css (grid, containers, responsive)
|
|
||||||
* - components.css (buttons, forms, alerts)
|
|
||||||
* - utilities.css (helper classes)
|
|
||||||
*
|
|
||||||
* Alternatively, use CSS preprocessing (Sass, Less, PostCSS) to organize
|
|
||||||
* code into partial files that compile into a single output file.
|
|
||||||
*
|
|
||||||
* @package Joomla.Site
|
|
||||||
* @subpackage Templates.yourtemplate
|
|
||||||
* @copyright Copyright (C) 2026. All rights reserved.
|
|
||||||
* @license GNU General Public License version 2 or later
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
CSS Custom Properties (Variables)
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
:root {
|
|
||||||
/* Colors */
|
|
||||||
--color-primary: #0066cc;
|
|
||||||
--color-primary-dark: #0052a3;
|
|
||||||
--color-text: #333;
|
|
||||||
--color-text-light: #666;
|
|
||||||
--color-background: #fff;
|
|
||||||
--color-background-light: #f9f9f9;
|
|
||||||
--color-background-gray: #f5f5f5;
|
|
||||||
--color-border: #e0e0e0;
|
|
||||||
--color-error: #d9534f;
|
|
||||||
--color-success: #5cb85c;
|
|
||||||
--color-warning: #f0ad4e;
|
|
||||||
--color-info: #5bc0de;
|
|
||||||
|
|
||||||
/* Typography */
|
|
||||||
--font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
||||||
--font-size-base: 1rem;
|
|
||||||
--line-height-base: 1.6;
|
|
||||||
|
|
||||||
/* Spacing */
|
|
||||||
--spacing-xs: 0.25rem;
|
|
||||||
--spacing-sm: 0.5rem;
|
|
||||||
--spacing-md: 1rem;
|
|
||||||
--spacing-lg: 1.5rem;
|
|
||||||
--spacing-xl: 3rem;
|
|
||||||
|
|
||||||
/* Layout */
|
|
||||||
--container-max-width: 1200px;
|
|
||||||
--border-radius: 4px;
|
|
||||||
--box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Base Styles
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
font-size: 16px;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
font-family: var(--font-family-base);
|
|
||||||
font-size: var(--font-size-base);
|
|
||||||
line-height: var(--line-height-base);
|
|
||||||
color: var(--color-text);
|
|
||||||
background-color: var(--color-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Layout Containers
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.container {
|
|
||||||
width: 100%;
|
|
||||||
max-width: var(--container-max-width);
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 0 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-fluid {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin: 0 -15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
[class*="col-"] {
|
|
||||||
padding: 0 15px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Grid System
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
.col-md-3 {
|
|
||||||
width: 25%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-md-6 {
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-md-9 {
|
|
||||||
width: 75%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-md-12 {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Header Styles
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.site-header {
|
|
||||||
background: var(--color-background);
|
|
||||||
border-bottom: 1px solid var(--color-border);
|
|
||||||
padding: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-header.sticky-header {
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 1000;
|
|
||||||
box-shadow: var(--box-shadow);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-inner {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-branding {
|
|
||||||
flex: 0 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-logo {
|
|
||||||
max-height: 60px;
|
|
||||||
width: auto;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-title {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 1.75rem;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-title a {
|
|
||||||
color: var(--color-text);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-title a:hover {
|
|
||||||
color: var(--color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-description {
|
|
||||||
margin-top: 5px;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
color: var(--color-text-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-modules {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Top Bar
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.top-bar {
|
|
||||||
background: var(--color-background-gray);
|
|
||||||
padding: 10px 0;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Navigation Styles
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.site-navigation {
|
|
||||||
background: var(--color-primary);
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-navigation ul {
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-navigation li {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-navigation a {
|
|
||||||
display: block;
|
|
||||||
padding: 15px 20px;
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-navigation a:hover,
|
|
||||||
.site-navigation a:focus {
|
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-navigation .active > a {
|
|
||||||
background-color: rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Banner Area
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.banner-area {
|
|
||||||
padding: 40px 0;
|
|
||||||
background: var(--color-background-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Main Content Area
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.site-main {
|
|
||||||
padding: 40px 0;
|
|
||||||
min-height: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-area {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-content {
|
|
||||||
margin: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-top,
|
|
||||||
.main-bottom {
|
|
||||||
margin: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Sidebar Styles
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
padding: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar .module {
|
|
||||||
margin-bottom: 30px;
|
|
||||||
padding: 20px;
|
|
||||||
background: var(--color-background-light);
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar .module h3 {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
font-size: 1.25rem;
|
|
||||||
border-bottom: 2px solid var(--color-primary);
|
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Footer Styles
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.site-footer {
|
|
||||||
background: var(--color-text);
|
|
||||||
color: var(--color-background);
|
|
||||||
padding: 40px 0 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-footer a {
|
|
||||||
color: var(--color-background);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-footer a:hover {
|
|
||||||
color: var(--color-primary);
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Error Page Styles
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.site-error {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
background: var(--color-background-gray);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-container {
|
|
||||||
max-width: 600px;
|
|
||||||
padding: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-content {
|
|
||||||
background: var(--color-background);
|
|
||||||
padding: 40px;
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
box-shadow: var(--box-shadow);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-logo {
|
|
||||||
max-height: 80px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-message h2 {
|
|
||||||
color: var(--color-error);
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-actions {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-technical {
|
|
||||||
margin-top: 30px;
|
|
||||||
padding: 20px;
|
|
||||||
background: var(--color-background-light);
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
text-align: left;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Offline Page Styles
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.site-offline {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
background: var(--color-background-gray);
|
|
||||||
}
|
|
||||||
|
|
||||||
.offline-container {
|
|
||||||
max-width: 500px;
|
|
||||||
padding: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.offline-content {
|
|
||||||
background: var(--color-background);
|
|
||||||
padding: 40px;
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
box-shadow: var(--box-shadow);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.offline-logo {
|
|
||||||
max-height: 80px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Buttons
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 10px 20px;
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: 400;
|
|
||||||
text-align: center;
|
|
||||||
text-decoration: none;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background-color: var(--color-primary);
|
|
||||||
border-color: var(--color-primary);
|
|
||||||
color: var(--color-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background-color: var(--color-primary-dark);
|
|
||||||
border-color: var(--color-primary-dark);
|
|
||||||
color: var(--color-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Messages
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.alert {
|
|
||||||
padding: 15px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
}
|
|
||||||
|
|
||||||
.alert-success {
|
|
||||||
background-color: #d4edda;
|
|
||||||
border-color: #c3e6cb;
|
|
||||||
color: #155724;
|
|
||||||
}
|
|
||||||
|
|
||||||
.alert-info {
|
|
||||||
background-color: #d1ecf1;
|
|
||||||
border-color: #bee5eb;
|
|
||||||
color: #0c5460;
|
|
||||||
}
|
|
||||||
|
|
||||||
.alert-warning {
|
|
||||||
background-color: #fff3cd;
|
|
||||||
border-color: #ffeaa7;
|
|
||||||
color: #856404;
|
|
||||||
}
|
|
||||||
|
|
||||||
.alert-error,
|
|
||||||
.alert-danger {
|
|
||||||
background-color: #f8d7da;
|
|
||||||
border-color: #f5c6cb;
|
|
||||||
color: #721c24;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Typography
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
font-weight: 600;
|
|
||||||
line-height: 1.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 { font-size: 2.5rem; }
|
|
||||||
h2 { font-size: 2rem; }
|
|
||||||
h3 { font-size: 1.75rem; }
|
|
||||||
h4 { font-size: 1.5rem; }
|
|
||||||
h5 { font-size: 1.25rem; }
|
|
||||||
h6 { font-size: 1rem; }
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: var(--color-primary);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover {
|
|
||||||
color: var(--color-primary-dark);
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Responsive Styles
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
|
||||||
.header-inner {
|
|
||||||
flex-direction: column;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-modules {
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Mobile navigation styling
|
|
||||||
* Note: This provides basic stacking for mobile. For a toggle menu,
|
|
||||||
* add a .mobile-menu-toggle button and implement show/hide functionality.
|
|
||||||
* See template.js for the toggle handler.
|
|
||||||
*/
|
|
||||||
.site-navigation ul {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-navigation a {
|
|
||||||
padding: 12px 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mobile menu toggle button (add to your template HTML) */
|
|
||||||
.mobile-menu-toggle {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 10px;
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mobile menu active state */
|
|
||||||
.site-navigation.mobile-menu-active {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
[class*="col-"] {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Accessibility
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px;
|
|
||||||
height: 1px;
|
|
||||||
padding: 0;
|
|
||||||
margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap;
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:focus,
|
|
||||||
button:focus {
|
|
||||||
outline: 2px solid var(--color-primary);
|
|
||||||
outline-offset: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Utilities
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
.text-center {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-right {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-left {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-0 { margin-top: 0; }
|
|
||||||
.mt-1 { margin-top: 0.25rem; }
|
|
||||||
.mt-2 { margin-top: 0.5rem; }
|
|
||||||
.mt-3 { margin-top: 1rem; }
|
|
||||||
.mt-4 { margin-top: 1.5rem; }
|
|
||||||
.mt-5 { margin-top: 3rem; }
|
|
||||||
|
|
||||||
.mb-0 { margin-bottom: 0; }
|
|
||||||
.mb-1 { margin-bottom: 0.25rem; }
|
|
||||||
.mb-2 { margin-bottom: 0.5rem; }
|
|
||||||
.mb-3 { margin-bottom: 1rem; }
|
|
||||||
.mb-4 { margin-bottom: 1.5rem; }
|
|
||||||
.mb-5 { margin-bottom: 3rem; }
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @package Joomla.Site
|
|
||||||
* @subpackage Templates.yourtemplate
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2026. All rights reserved.
|
|
||||||
* @license GNU General Public License version 2 or later
|
|
||||||
*/
|
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\Factory;
|
|
||||||
use Joomla\CMS\Language\Text;
|
|
||||||
use Joomla\CMS\Uri\Uri;
|
|
||||||
|
|
||||||
/** @var Joomla\CMS\Document\ErrorDocument $this */
|
|
||||||
|
|
||||||
$app = Factory::getApplication();
|
|
||||||
$wa = $this->getWebAssetManager();
|
|
||||||
|
|
||||||
// Template params
|
|
||||||
$logo = $this->params->get('logo');
|
|
||||||
$sitename = htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8');
|
|
||||||
|
|
||||||
// Add template CSS
|
|
||||||
$wa->registerAndUseStyle(
|
|
||||||
'template.yourtemplate',
|
|
||||||
'templates/' . $this->template . '/css/template.css',
|
|
||||||
[],
|
|
||||||
['version' => 'auto']
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title><?php echo $this->title; ?> - <?php echo $sitename; ?></title>
|
|
||||||
<jdoc:include type="styles" />
|
|
||||||
<jdoc:include type="scripts" />
|
|
||||||
</head>
|
|
||||||
<body class="site-error">
|
|
||||||
<div class="error-container">
|
|
||||||
<div class="error-content">
|
|
||||||
<?php if ($logo) : ?>
|
|
||||||
<a href="<?php echo Uri::root(); ?>">
|
|
||||||
<img src="<?php echo Uri::root() . htmlspecialchars($logo, ENT_QUOTES, 'UTF-8'); ?>" alt="<?php echo $sitename; ?>" class="error-logo">
|
|
||||||
</a>
|
|
||||||
<?php else : ?>
|
|
||||||
<h1 class="site-title">
|
|
||||||
<a href="<?php echo Uri::root(); ?>"><?php echo $sitename; ?></a>
|
|
||||||
</h1>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="error-message">
|
|
||||||
<h2><?php echo Text::_('JERROR_LAYOUT_PAGE_NOT_FOUND'); ?></h2>
|
|
||||||
<div class="error-details">
|
|
||||||
<p><strong><?php echo Text::_('JERROR_LAYOUT_ERROR_HAS_OCCURRED_WHILE_PROCESSING_YOUR_REQUEST'); ?></strong></p>
|
|
||||||
<?php if ($this->debug) : ?>
|
|
||||||
<div class="error-debug">
|
|
||||||
<p><?php echo Text::_('JERROR_LAYOUT_NOT_ABLE_TO_VISIT'); ?></p>
|
|
||||||
<ul>
|
|
||||||
<li><?php echo Text::_('JERROR_LAYOUT_AN_OUT_OF_DATE_BOOKMARK_FAVOURITE'); ?></li>
|
|
||||||
<li><?php echo Text::_('JERROR_LAYOUT_MIS_TYPED_ADDRESS'); ?></li>
|
|
||||||
<li><?php echo Text::_('JERROR_LAYOUT_SEARCH_ENGINE_OUT_OF_DATE_LISTING'); ?></li>
|
|
||||||
<li><?php echo Text::_('JERROR_LAYOUT_YOU_HAVE_NO_ACCESS_TO_THIS_PAGE'); ?></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="error-actions">
|
|
||||||
<a href="<?php echo Uri::root(); ?>" class="btn btn-primary">
|
|
||||||
<?php echo Text::_('JERROR_LAYOUT_GO_TO_THE_HOME_PAGE'); ?>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($this->debug) : ?>
|
|
||||||
<div class="error-technical">
|
|
||||||
<h3><?php echo Text::_('JERROR_LAYOUT_TECHNICAL_INFORMATION'); ?></h3>
|
|
||||||
<p><?php echo $this->error->getMessage(); ?></p>
|
|
||||||
<p>
|
|
||||||
<?php if ($this->error->getCode()) : ?>
|
|
||||||
<?php echo Text::_('JERROR_LAYOUT_ERROR_CODE'); ?>: <?php echo $this->error->getCode(); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,183 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @package Joomla.Site
|
|
||||||
* @subpackage Templates.yourtemplate
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2026. All rights reserved.
|
|
||||||
* @license GNU General Public License version 2 or later
|
|
||||||
*/
|
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\Factory;
|
|
||||||
use Joomla\CMS\Uri\Uri;
|
|
||||||
|
|
||||||
/** @var Joomla\CMS\Document\HtmlDocument $this */
|
|
||||||
|
|
||||||
$app = Factory::getApplication();
|
|
||||||
$wa = $this->getWebAssetManager();
|
|
||||||
|
|
||||||
// Detecting Active Variables
|
|
||||||
$option = $app->input->getCmd('option', '');
|
|
||||||
$view = $app->input->getCmd('view', '');
|
|
||||||
$layout = $app->input->getCmd('layout', '');
|
|
||||||
$task = $app->input->getCmd('task', '');
|
|
||||||
$itemid = $app->input->getCmd('Itemid', '');
|
|
||||||
$sitename = htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8');
|
|
||||||
$menu = $app->getMenu()->getActive();
|
|
||||||
$pageclass = $menu !== null ? $menu->getParams()->get('pageclass_sfx', '') : '';
|
|
||||||
|
|
||||||
// Template params
|
|
||||||
$logo = $this->params->get('logo');
|
|
||||||
$siteTitle = $this->params->get('siteTitle', $sitename);
|
|
||||||
$siteDescription = $this->params->get('siteDescription', '');
|
|
||||||
$containerFluid = (bool) $this->params->get('containerFluid', false);
|
|
||||||
$stickyHeader = (bool) $this->params->get('stickyHeader', false);
|
|
||||||
|
|
||||||
// Add template CSS
|
|
||||||
$wa->registerAndUseStyle(
|
|
||||||
'template.yourtemplate',
|
|
||||||
'templates/' . $this->template . '/css/template.css',
|
|
||||||
[],
|
|
||||||
['version' => 'auto']
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add template JavaScript
|
|
||||||
$wa->registerAndUseScript(
|
|
||||||
'template.yourtemplate',
|
|
||||||
'templates/' . $this->template . '/js/template.js',
|
|
||||||
[],
|
|
||||||
['version' => 'auto', 'defer' => true]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add viewport meta tag for responsive design
|
|
||||||
$this->setMetaData('viewport', 'width=device-width, initial-scale=1.0');
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
|
|
||||||
<head>
|
|
||||||
<jdoc:include type="metas" />
|
|
||||||
<jdoc:include type="styles" />
|
|
||||||
<jdoc:include type="scripts" />
|
|
||||||
</head>
|
|
||||||
<body class="site <?php echo $option
|
|
||||||
. ' view-' . $view
|
|
||||||
. ($layout ? ' layout-' . $layout : ' no-layout')
|
|
||||||
. ($task ? ' task-' . $task : ' no-task')
|
|
||||||
. ($itemid ? ' itemid-' . $itemid : '')
|
|
||||||
. ($pageclass ? ' ' . $pageclass : '')
|
|
||||||
. ($this->direction === 'rtl' ? ' rtl' : '');
|
|
||||||
?>">
|
|
||||||
|
|
||||||
<?php if ($this->countModules('top')) : ?>
|
|
||||||
<div class="top-bar">
|
|
||||||
<div class="<?php echo $containerFluid ? 'container-fluid' : 'container'; ?>">
|
|
||||||
<jdoc:include type="modules" name="top" style="html5" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<header class="site-header<?php echo $stickyHeader ? ' sticky-header' : ''; ?>">
|
|
||||||
<div class="<?php echo $containerFluid ? 'container-fluid' : 'container'; ?>">
|
|
||||||
<div class="header-inner">
|
|
||||||
<div class="site-branding">
|
|
||||||
<?php if ($logo) : ?>
|
|
||||||
<a href="<?php echo Uri::root(); ?>" title="<?php echo $siteTitle; ?>">
|
|
||||||
<img src="<?php echo Uri::root() . htmlspecialchars($logo, ENT_QUOTES, 'UTF-8'); ?>" alt="<?php echo $siteTitle; ?>" class="site-logo">
|
|
||||||
</a>
|
|
||||||
<?php else : ?>
|
|
||||||
<div class="site-title">
|
|
||||||
<a href="<?php echo Uri::root(); ?>" title="<?php echo $siteTitle; ?>">
|
|
||||||
<?php echo $siteTitle; ?>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($siteDescription) : ?>
|
|
||||||
<div class="site-description">
|
|
||||||
<?php echo htmlspecialchars($siteDescription, ENT_QUOTES, 'UTF-8'); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($this->countModules('header')) : ?>
|
|
||||||
<div class="header-modules">
|
|
||||||
<jdoc:include type="modules" name="header" style="html5" />
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<?php if ($this->countModules('navigation')) : ?>
|
|
||||||
<nav class="site-navigation" role="navigation">
|
|
||||||
<div class="<?php echo $containerFluid ? 'container-fluid' : 'container'; ?>">
|
|
||||||
<jdoc:include type="modules" name="navigation" style="html5" />
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($this->countModules('banner')) : ?>
|
|
||||||
<div class="banner-area">
|
|
||||||
<div class="<?php echo $containerFluid ? 'container-fluid' : 'container'; ?>">
|
|
||||||
<jdoc:include type="modules" name="banner" style="html5" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<main class="site-main">
|
|
||||||
<div class="<?php echo $containerFluid ? 'container-fluid' : 'container'; ?>">
|
|
||||||
<div class="row">
|
|
||||||
<?php if ($this->countModules('sidebar-left')) : ?>
|
|
||||||
<aside class="sidebar sidebar-left col-md-3">
|
|
||||||
<jdoc:include type="modules" name="sidebar-left" style="html5" />
|
|
||||||
</aside>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="content-area <?php
|
|
||||||
echo $this->countModules('sidebar-left') && $this->countModules('sidebar-right') ? 'col-md-6'
|
|
||||||
: ($this->countModules('sidebar-left') || $this->countModules('sidebar-right') ? 'col-md-9'
|
|
||||||
: 'col-md-12');
|
|
||||||
?>">
|
|
||||||
<?php if ($this->countModules('main-top')) : ?>
|
|
||||||
<div class="main-top">
|
|
||||||
<jdoc:include type="modules" name="main-top" style="html5" />
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="main-content">
|
|
||||||
<jdoc:include type="message" />
|
|
||||||
<jdoc:include type="component" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($this->countModules('main-bottom')) : ?>
|
|
||||||
<div class="main-bottom">
|
|
||||||
<jdoc:include type="modules" name="main-bottom" style="html5" />
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($this->countModules('sidebar-right')) : ?>
|
|
||||||
<aside class="sidebar sidebar-right col-md-3">
|
|
||||||
<jdoc:include type="modules" name="sidebar-right" style="html5" />
|
|
||||||
</aside>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<?php if ($this->countModules('footer')) : ?>
|
|
||||||
<footer class="site-footer">
|
|
||||||
<div class="<?php echo $containerFluid ? 'container-fluid' : 'container'; ?>">
|
|
||||||
<jdoc:include type="modules" name="footer" style="html5" />
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($this->countModules('debug')) : ?>
|
|
||||||
<div class="debug-area">
|
|
||||||
<jdoc:include type="modules" name="debug" style="none" />
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* Custom JavaScript for yourtemplate
|
|
||||||
*
|
|
||||||
* This file is for user customizations.
|
|
||||||
* It will not be overwritten during template updates.
|
|
||||||
*
|
|
||||||
* @package Joomla.Site
|
|
||||||
* @subpackage Templates.yourtemplate
|
|
||||||
* @copyright Copyright (C) 2026. All rights reserved.
|
|
||||||
* @license GNU General Public License version 2 or later
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Add your custom JavaScript code below this line
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
/**
|
|
||||||
* Template JavaScript for yourtemplate
|
|
||||||
*
|
|
||||||
* @package Joomla.Site
|
|
||||||
* @subpackage Templates.yourtemplate
|
|
||||||
* @copyright Copyright (C) 2026. All rights reserved.
|
|
||||||
* @license GNU General Public License version 2 or later
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize template functionality when DOM is ready
|
|
||||||
*/
|
|
||||||
function initTemplate() {
|
|
||||||
// Mobile menu toggle
|
|
||||||
initMobileMenu();
|
|
||||||
|
|
||||||
// Smooth scroll for anchor links
|
|
||||||
initSmoothScroll();
|
|
||||||
|
|
||||||
// Sticky header enhancement
|
|
||||||
initStickyHeader();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mobile menu functionality
|
|
||||||
*
|
|
||||||
* Note: This requires a mobile menu toggle button to be added to your template.
|
|
||||||
* Add the following button in your header area:
|
|
||||||
*
|
|
||||||
* <button class="mobile-menu-toggle" aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
* <span class="menu-icon"></span>
|
|
||||||
* </button>
|
|
||||||
*
|
|
||||||
* And add CSS for the toggle button and mobile menu states.
|
|
||||||
*/
|
|
||||||
function initMobileMenu() {
|
|
||||||
const mobileMenuToggle = document.querySelector('.mobile-menu-toggle');
|
|
||||||
const navigation = document.querySelector('.site-navigation');
|
|
||||||
|
|
||||||
if (mobileMenuToggle && navigation) {
|
|
||||||
mobileMenuToggle.addEventListener('click', function () {
|
|
||||||
navigation.classList.toggle('mobile-menu-active');
|
|
||||||
const isExpanded = navigation.classList.contains('mobile-menu-active');
|
|
||||||
this.setAttribute('aria-expanded', isExpanded ? 'true' : 'false');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Smooth scroll for anchor links
|
|
||||||
*/
|
|
||||||
function initSmoothScroll() {
|
|
||||||
const anchorLinks = document.querySelectorAll('a[href^="#"]');
|
|
||||||
|
|
||||||
anchorLinks.forEach(function (link) {
|
|
||||||
link.addEventListener('click', function (e) {
|
|
||||||
const targetId = this.getAttribute('href');
|
|
||||||
|
|
||||||
// Skip if it's just "#" or "#top"
|
|
||||||
if (targetId === '#' || targetId === '#top') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const targetElement = document.querySelector(targetId);
|
|
||||||
|
|
||||||
if (targetElement) {
|
|
||||||
e.preventDefault();
|
|
||||||
targetElement.scrollIntoView({
|
|
||||||
behavior: 'smooth',
|
|
||||||
block: 'start'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sticky header enhancement
|
|
||||||
*/
|
|
||||||
function initStickyHeader() {
|
|
||||||
const header = document.querySelector('.site-header.sticky-header');
|
|
||||||
|
|
||||||
if (header) {
|
|
||||||
let lastScrollTop = 0;
|
|
||||||
|
|
||||||
window.addEventListener('scroll', function () {
|
|
||||||
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
||||||
|
|
||||||
// Add/remove class based on scroll direction
|
|
||||||
if (scrollTop > lastScrollTop && scrollTop > 100) {
|
|
||||||
// Scrolling down
|
|
||||||
header.classList.add('header-hidden');
|
|
||||||
} else {
|
|
||||||
// Scrolling up
|
|
||||||
header.classList.remove('header-hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
lastScrollTop = scrollTop <= 0 ? 0 : scrollTop;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize when DOM is ready
|
|
||||||
*/
|
|
||||||
if (document.readyState === 'loading') {
|
|
||||||
document.addEventListener('DOMContentLoaded', initTemplate);
|
|
||||||
} else {
|
|
||||||
initTemplate();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @package Joomla.Site
|
|
||||||
* @subpackage Templates.yourtemplate
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2026. All rights reserved.
|
|
||||||
* @license GNU General Public License version 2 or later
|
|
||||||
*/
|
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\Factory;
|
|
||||||
use Joomla\CMS\Uri\Uri;
|
|
||||||
|
|
||||||
/** @var Joomla\CMS\Document\HtmlDocument $this */
|
|
||||||
|
|
||||||
$app = Factory::getApplication();
|
|
||||||
$wa = $this->getWebAssetManager();
|
|
||||||
|
|
||||||
// Template params
|
|
||||||
$logo = $this->params->get('logo');
|
|
||||||
$sitename = htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8');
|
|
||||||
|
|
||||||
// Add template CSS
|
|
||||||
$wa->registerAndUseStyle(
|
|
||||||
'template.yourtemplate',
|
|
||||||
'templates/' . $this->template . '/css/template.css',
|
|
||||||
[],
|
|
||||||
['version' => 'auto']
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
|
|
||||||
<head>
|
|
||||||
<jdoc:include type="metas" />
|
|
||||||
<jdoc:include type="styles" />
|
|
||||||
<jdoc:include type="scripts" />
|
|
||||||
</head>
|
|
||||||
<body class="site-offline">
|
|
||||||
<div class="offline-container">
|
|
||||||
<div class="offline-content">
|
|
||||||
<?php if ($logo) : ?>
|
|
||||||
<img src="<?php echo Uri::root() . htmlspecialchars($logo, ENT_QUOTES, 'UTF-8'); ?>" alt="<?php echo $sitename; ?>" class="offline-logo">
|
|
||||||
<?php else : ?>
|
|
||||||
<h1><?php echo $sitename; ?></h1>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<jdoc:include type="message" />
|
|
||||||
<jdoc:include type="component" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<extension type="template" client="site" method="upgrade">
|
|
||||||
<name>yourtemplate</name>
|
|
||||||
<creationDate>2026-04-27</creationDate>
|
|
||||||
<author>Your Name</author>
|
|
||||||
<authorEmail>your.email@example.com</authorEmail>
|
|
||||||
<authorUrl>https://www.example.com</authorUrl>
|
|
||||||
<copyright>Copyright (C) 2026. All rights reserved.</copyright>
|
|
||||||
<license>GNU General Public License version 2 or later</license>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>TPL_YOURTEMPLATE_XML_DESCRIPTION</description>
|
|
||||||
|
|
||||||
<files>
|
|
||||||
<filename>index.php</filename>
|
|
||||||
<filename>templateDetails.xml</filename>
|
|
||||||
<!--
|
|
||||||
IMPORTANT: Add actual PNG images before distribution
|
|
||||||
|
|
||||||
1. Replace template_thumbnail.png.txt and template_preview.png.txt with real PNG images
|
|
||||||
2. Uncomment the two lines below after adding the actual image files
|
|
||||||
3. See src/IMAGES.md for detailed instructions
|
|
||||||
|
|
||||||
Once images are added, uncomment these lines:
|
|
||||||
-->
|
|
||||||
<!-- <filename>template_thumbnail.png</filename> -->
|
|
||||||
<!-- <filename>template_preview.png</filename> -->
|
|
||||||
<filename>offline.php</filename>
|
|
||||||
<filename>error.php</filename>
|
|
||||||
<folder>css</folder>
|
|
||||||
<folder>js</folder>
|
|
||||||
<folder>images</folder>
|
|
||||||
<folder>fonts</folder>
|
|
||||||
<folder>language</folder>
|
|
||||||
<folder>html</folder>
|
|
||||||
</files>
|
|
||||||
|
|
||||||
<positions>
|
|
||||||
<position>top</position>
|
|
||||||
<position>header</position>
|
|
||||||
<position>navigation</position>
|
|
||||||
<position>banner</position>
|
|
||||||
<position>sidebar-left</position>
|
|
||||||
<position>sidebar-right</position>
|
|
||||||
<position>main-top</position>
|
|
||||||
<position>main</position>
|
|
||||||
<position>main-bottom</position>
|
|
||||||
<position>footer</position>
|
|
||||||
<position>debug</position>
|
|
||||||
</positions>
|
|
||||||
|
|
||||||
<config>
|
|
||||||
<fields name="params">
|
|
||||||
<fieldset name="advanced">
|
|
||||||
<field
|
|
||||||
name="logo"
|
|
||||||
type="media"
|
|
||||||
label="TPL_YOURTEMPLATE_LOGO_LABEL"
|
|
||||||
description="TPL_YOURTEMPLATE_LOGO_DESC"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<field
|
|
||||||
name="siteTitle"
|
|
||||||
type="text"
|
|
||||||
label="TPL_YOURTEMPLATE_SITE_TITLE_LABEL"
|
|
||||||
description="TPL_YOURTEMPLATE_SITE_TITLE_DESC"
|
|
||||||
default=""
|
|
||||||
/>
|
|
||||||
|
|
||||||
<field
|
|
||||||
name="siteDescription"
|
|
||||||
type="textarea"
|
|
||||||
label="TPL_YOURTEMPLATE_SITE_DESCRIPTION_LABEL"
|
|
||||||
description="TPL_YOURTEMPLATE_SITE_DESCRIPTION_DESC"
|
|
||||||
rows="3"
|
|
||||||
cols="30"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<field
|
|
||||||
name="containerFluid"
|
|
||||||
type="radio"
|
|
||||||
label="TPL_YOURTEMPLATE_CONTAINER_FLUID_LABEL"
|
|
||||||
description="TPL_YOURTEMPLATE_CONTAINER_FLUID_DESC"
|
|
||||||
default="0"
|
|
||||||
layout="joomla.form.field.radio.switcher"
|
|
||||||
>
|
|
||||||
<option value="0">JNO</option>
|
|
||||||
<option value="1">JYES</option>
|
|
||||||
</field>
|
|
||||||
|
|
||||||
<field
|
|
||||||
name="stickyHeader"
|
|
||||||
type="radio"
|
|
||||||
label="TPL_YOURTEMPLATE_STICKY_HEADER_LABEL"
|
|
||||||
description="TPL_YOURTEMPLATE_STICKY_HEADER_DESC"
|
|
||||||
default="0"
|
|
||||||
layout="joomla.form.field.radio.switcher"
|
|
||||||
>
|
|
||||||
<option value="0">JNO</option>
|
|
||||||
<option value="1">JYES</option>
|
|
||||||
</field>
|
|
||||||
</fieldset>
|
|
||||||
</fields>
|
|
||||||
</config>
|
|
||||||
</extension>
|
|
||||||
Reference in New Issue
Block a user