chore: update .github/workflows/deploy-dev.yml from MokoStandards
This commit is contained in:
46
.github/workflows/deploy-dev.yml
vendored
46
.github/workflows/deploy-dev.yml
vendored
@@ -22,7 +22,7 @@
|
|||||||
# INGROUP: MokoStandards.Deploy
|
# INGROUP: MokoStandards.Deploy
|
||||||
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
|
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
|
||||||
# PATH: /templates/workflows/shared/deploy-dev.yml
|
# PATH: /templates/workflows/shared/deploy-dev.yml
|
||||||
# VERSION: 04.01.00
|
# VERSION: 04.02.00
|
||||||
# BRIEF: SFTP deployment workflow for development server — synced to all governed repos
|
# BRIEF: SFTP deployment workflow for development server — synced to all governed repos
|
||||||
# NOTE: Synced via bulk-repo-sync to .github/workflows/deploy-dev.yml in all governed repos.
|
# NOTE: Synced via bulk-repo-sync to .github/workflows/deploy-dev.yml in all governed repos.
|
||||||
# Port is resolved in order: DEV_FTP_PORT variable → :port suffix in DEV_FTP_HOST → 22.
|
# Port is resolved in order: DEV_FTP_PORT variable → :port suffix in DEV_FTP_HOST → 22.
|
||||||
@@ -73,6 +73,9 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-permission:
|
check-permission:
|
||||||
name: Verify Deployment Permission
|
name: Verify Deployment Permission
|
||||||
@@ -347,8 +350,8 @@ jobs:
|
|||||||
|
|
||||||
# ── Platform-specific path safety guards ──────────────────────────────
|
# ── Platform-specific path safety guards ──────────────────────────────
|
||||||
PLATFORM=""
|
PLATFORM=""
|
||||||
if [ -f ".moko-standards" ]; then
|
MOKO_FILE=".github/.moko-standards"; [ ! -f "$MOKO_FILE" ] && MOKO_FILE=".moko-standards"; if [ -f "$MOKO_FILE" ]; then
|
||||||
PLATFORM=$(grep -E '^platform:' .moko-standards | sed 's/.*:[[:space:]]*//' | tr -d '"')
|
PLATFORM=$(grep -oP '^platform:.*' "$MOKO_FILE" 2>/dev/null || true)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PLATFORM" = "crm-module" ]; then
|
if [ "$PLATFORM" = "crm-module" ]; then
|
||||||
@@ -420,14 +423,17 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
||||||
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --quiet \
|
git clone --depth 1 --branch version/04.02.00 --quiet \
|
||||||
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
||||||
/tmp/mokostandards
|
/tmp/mokostandards
|
||||||
cd /tmp/mokostandards
|
cd /tmp/mokostandards
|
||||||
composer install --no-dev --no-interaction --quiet
|
composer install --no-dev --no-interaction --quiet
|
||||||
|
|
||||||
- name: Clear remote destination folder
|
- name: Clear remote destination folder (manual only)
|
||||||
if: steps.source.outputs.skip == 'false' && steps.remote.outputs.skip != 'true'
|
if: >-
|
||||||
|
steps.source.outputs.skip == 'false' &&
|
||||||
|
steps.remote.outputs.skip != 'true' &&
|
||||||
|
inputs.clear_remote == true
|
||||||
env:
|
env:
|
||||||
SFTP_HOST: ${{ steps.conn.outputs.host }}
|
SFTP_HOST: ${{ steps.conn.outputs.host }}
|
||||||
SFTP_PORT: ${{ steps.conn.outputs.port }}
|
SFTP_PORT: ${{ steps.conn.outputs.port }}
|
||||||
@@ -574,24 +580,8 @@ jobs:
|
|||||||
DEPLOY_ARGS+=(--key-passphrase "$SFTP_PASSWORD")
|
DEPLOY_ARGS+=(--key-passphrase "$SFTP_PASSWORD")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── For Dolibarr (crm-module): set version to "development" before deploy ─
|
# Set platform version to "development" before deploy (Dolibarr + Joomla)
|
||||||
PLATFORM=""
|
php /tmp/mokostandards/api/cli/version_set_platform.php --path . --version development
|
||||||
if [ -f ".moko-standards" ]; then
|
|
||||||
PLATFORM=$(grep -E '^platform:' .moko-standards | sed 's/.*:[[:space:]]*//' | tr -d '"')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PLATFORM" = "crm-module" ]; then
|
|
||||||
echo "📦 Dolibarr dev deploy — setting module version to 'development'"
|
|
||||||
find "$SOURCE_DIR" -path "*/core/modules/mod*.class.php" -exec \
|
|
||||||
sed -i "s/\(\$this->version\s*=\s*\)['\"][^'\"]*['\"]/\1'development'/" {} + 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PLATFORM" = "waas-component" ]; then
|
|
||||||
echo "📦 Joomla dev deploy — setting manifest version to 'development'"
|
|
||||||
find "$SOURCE_DIR" -maxdepth 2 -name "*.xml" -exec grep -l '<extension' {} \; 2>/dev/null | while read -r manifest; do
|
|
||||||
sed -i "s|<version>[^<]*</version>|<version>development</version>|" "$manifest" 2>/dev/null || true
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
php /tmp/mokostandards/api/deploy/deploy-sftp.php "${DEPLOY_ARGS[@]}"
|
php /tmp/mokostandards/api/deploy/deploy-sftp.php "${DEPLOY_ARGS[@]}"
|
||||||
# (deploy-sftp.php handles dotfile skipping and .ftp_ignore natively)
|
# (deploy-sftp.php handles dotfile skipping and .ftp_ignore natively)
|
||||||
@@ -641,22 +631,22 @@ jobs:
|
|||||||
--force 2>/dev/null || true
|
--force 2>/dev/null || true
|
||||||
|
|
||||||
# Look for an existing open deploy-failure issue
|
# Look for an existing open deploy-failure issue
|
||||||
EXISTING=$(gh api "repos/${REPO}/issues?labels=${LABEL}&state=open&per_page=1" \
|
EXISTING=$(gh api "repos/${REPO}/issues?labels=${LABEL}&state=all&per_page=1&sort=created&direction=desc" \
|
||||||
--jq '.[0].number' 2>/dev/null)
|
--jq '.[0].number' 2>/dev/null)
|
||||||
|
|
||||||
if [ -n "$EXISTING" ] && [ "$EXISTING" != "null" ]; then
|
if [ -n "$EXISTING" ] && [ "$EXISTING" != "null" ]; then
|
||||||
gh api "repos/${REPO}/issues/${EXISTING}" \
|
gh api "repos/${REPO}/issues/${EXISTING}" \
|
||||||
-X PATCH \
|
-X PATCH \
|
||||||
-f title="$TITLE" \
|
-f title="$TITLE" \
|
||||||
-f body="$BODY" \
|
-f body="$BODY" \n -f state="open" \
|
||||||
--silent
|
--silent
|
||||||
echo "📋 Failure issue #${EXISTING} updated: ${REPO}" >> "$GITHUB_STEP_SUMMARY"
|
echo "📋 Failure issue #${EXISTING} updated/reopened: ${REPO}" >> "$GITHUB_STEP_SUMMARY"
|
||||||
else
|
else
|
||||||
gh issue create \
|
gh issue create \
|
||||||
--repo "$REPO" \
|
--repo "$REPO" \
|
||||||
--title "$TITLE" \
|
--title "$TITLE" \
|
||||||
--body "$BODY" \
|
--body "$BODY" \
|
||||||
--label "$LABEL" \
|
--label "$LABEL" \n --assignee "jmiller-moko" \
|
||||||
| tee -a "$GITHUB_STEP_SUMMARY"
|
| tee -a "$GITHUB_STEP_SUMMARY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user