Template
fix: use metadata API for source-aware bumps instead of manifest.xml #32
@@ -45,18 +45,19 @@ jobs:
|
||||
|
||||
- name: Check for source changes
|
||||
id: source-check
|
||||
env:
|
||||
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||
run: |
|
||||
# Read platform and source directory from manifest
|
||||
PLATFORM=""
|
||||
SOURCE_DIR=""
|
||||
if [ -f ".mokogitea/manifest.xml" ]; then
|
||||
PLATFORM=$(grep -oP '<platform>\K[^<]+' .mokogitea/manifest.xml 2>/dev/null || true)
|
||||
SOURCE_DIR=$(grep -oP '<source-dir>\K[^<]+' .mokogitea/manifest.xml 2>/dev/null || true)
|
||||
ENTRY=$(grep -oP '<entry-point>\K[^<]+' .mokogitea/manifest.xml 2>/dev/null || true)
|
||||
SOURCE_DIR="${SOURCE_DIR:-$ENTRY}"
|
||||
fi
|
||||
GITEA_URL="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}"
|
||||
REPO="${{ github.repository }}"
|
||||
|
||||
# Default source dirs by platform
|
||||
# Fetch platform and entry_point from first-class repo metadata API
|
||||
METADATA=$(curl -sf -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||
"${GITEA_URL}/api/v1/repos/${REPO}/manifest" 2>/dev/null || echo "{}")
|
||||
PLATFORM=$(echo "$METADATA" | grep -oP '"platform"\s*:\s*"\K[^"]+' || true)
|
||||
SOURCE_DIR=$(echo "$METADATA" | grep -oP '"entry_point"\s*:\s*"\K[^"]+' || true)
|
||||
|
||||
# Default source dirs by platform if entry_point not set
|
||||
if [ -z "$SOURCE_DIR" ]; then
|
||||
case "$PLATFORM" in
|
||||
joomla) SOURCE_DIR="src/ source/ htdocs/" ;;
|
||||
@@ -68,7 +69,7 @@ jobs:
|
||||
# If no platform or source dir, always bump (generic repos)
|
||||
if [ -z "$SOURCE_DIR" ]; then
|
||||
echo "has_source_changes=true" >> "$GITHUB_OUTPUT"
|
||||
echo "No platform manifest — defaulting to bump"
|
||||
echo "No platform metadata — defaulting to bump"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -62,18 +62,19 @@ jobs:
|
||||
- name: Check for source changes
|
||||
id: source-check
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||
run: |
|
||||
# Read platform and source directory from manifest
|
||||
PLATFORM=""
|
||||
SOURCE_DIR=""
|
||||
if [ -f ".mokogitea/manifest.xml" ]; then
|
||||
PLATFORM=$(grep -oP '<platform>\K[^<]+' .mokogitea/manifest.xml 2>/dev/null || true)
|
||||
SOURCE_DIR=$(grep -oP '<source-dir>\K[^<]+' .mokogitea/manifest.xml 2>/dev/null || true)
|
||||
ENTRY=$(grep -oP '<entry-point>\K[^<]+' .mokogitea/manifest.xml 2>/dev/null || true)
|
||||
SOURCE_DIR="${SOURCE_DIR:-$ENTRY}"
|
||||
fi
|
||||
GITEA_URL="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}"
|
||||
REPO="${{ github.repository }}"
|
||||
|
||||
# Default source dirs by platform
|
||||
# Fetch platform and entry_point from first-class repo metadata API
|
||||
METADATA=$(curl -sf -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||
"${GITEA_URL}/api/v1/repos/${REPO}/manifest" 2>/dev/null || echo "{}")
|
||||
PLATFORM=$(echo "$METADATA" | grep -oP '"platform"\s*:\s*"\K[^"]+' || true)
|
||||
SOURCE_DIR=$(echo "$METADATA" | grep -oP '"entry_point"\s*:\s*"\K[^"]+' || true)
|
||||
|
||||
# Default source dirs by platform if entry_point not set
|
||||
if [ -z "$SOURCE_DIR" ]; then
|
||||
case "$PLATFORM" in
|
||||
joomla) SOURCE_DIR="src/ source/ htdocs/" ;;
|
||||
@@ -85,7 +86,7 @@ jobs:
|
||||
# If no platform or source dir, always build (generic repos)
|
||||
if [ -z "$SOURCE_DIR" ]; then
|
||||
echo "has_source_changes=true" >> "$GITHUB_OUTPUT"
|
||||
echo "No platform manifest — defaulting to build"
|
||||
echo "No platform metadata — defaulting to build"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user