update
Build WordPress Plugin (XML-driven) / build-release (push) Failing after 23s

This commit is contained in:
Mohamed Youssef
2026-08-02 10:10:54 +03:00
parent 4e54ecf721
commit 9019cf48d3
2 changed files with 38 additions and 25 deletions
+34 -25
View File
@@ -1,4 +1,4 @@
name: Build WordPress Plugin (Simple)
name: Build WordPress Plugin (XML-driven)
on:
push:
@@ -13,39 +13,49 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Install zip
run: sudo apt-get update && sudo apt-get install -y zip
- name: Install XML tools and zip
run: |
sudo apt-get update
sudo apt-get install -y libxml2-utils zip
# ------------------------------------------------------------
# 1. Find main plugin file (recursively) & extract slug/version
# 1. Extract metadata from plugin.xml
# ------------------------------------------------------------
- name: Extract plugin metadata
- name: Extract metadata from plugin.xml
id: meta
run: |
MAIN_FILE=$(find . -maxdepth 3 -type f -name "*.php" -exec grep -l "Plugin Name:" {} \; | head -n1)
if [ -z "$MAIN_FILE" ]; then
echo "❌ No plugin file with 'Plugin Name:' found!" >&2
# Ensure plugin.xml exists
if [ ! -f plugin.xml ]; then
echo "❌ plugin.xml not found!" >&2
exit 1
fi
MAIN_FILE=${MAIN_FILE#./}
VERSION=$(grep "^Version:" "$MAIN_FILE" | awk '{print $NF}' | tr -d '\r')
if [ -z "$VERSION" ]; then
echo "❌ Version not found in $MAIN_FILE" >&2
# Extract name and version (adjust XPath to your XML structure)
NAME=$(xmllint --xpath "string(//name)" plugin.xml)
VERSION=v$(xmllint --xpath "string(//version)" plugin.xml)
if [ -z "$NAME" ] || [ -z "$VERSION" ]; then
echo "❌ Could not extract <name> or <version> from plugin.xml" >&2
exit 1
fi
SLUG="${GITHUB_REPOSITORY##*/}"
echo "SLUG=$SLUG" >> $GITHUB_ENV
echo "PLUGIN_NAME=$NAME" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "FILENAME=${SLUG}-${VERSION}.zip" >> $GITHUB_ENV
echo "✅ Plugin: $SLUG, Version: $VERSION (main file: $MAIN_FILE)"
echo "FILENAME=${NAME}-${VERSION}.zip" >> $GITHUB_ENV
echo "✅ Plugin: $NAME, Version: $VERSION"
# ------------------------------------------------------------
# 2. Prepare package copy everything except .git and .github
# 2. Prepare package (copy everything EXCEPT plugin.xml, .git, .github)
# ------------------------------------------------------------
- name: Prepare package
run: |
mkdir -p build/"$SLUG"
rsync -a --exclude='.git' --exclude='.github' ./ build/"$SLUG"/
mkdir -p build/"$PLUGIN_NAME"
rsync -a \
--exclude='.git' \
--exclude='.github' \
--exclude='plugin.xml' \
./ build/"$PLUGIN_NAME"/
# ------------------------------------------------------------
# 3. Build the zip
@@ -53,7 +63,7 @@ jobs:
- name: Build plugin zip
run: |
cd build
zip -r "../$FILENAME" "$SLUG"
zip -r "../$FILENAME" "$PLUGIN_NAME"
cd ..
# ------------------------------------------------------------
@@ -66,7 +76,7 @@ jobs:
sudo mv tea /usr/local/bin/
# ------------------------------------------------------------
# 5. Configure tea (using your existing variables)
# 5. Configure tea
# ------------------------------------------------------------
- name: Configure tea
run: |
@@ -76,13 +86,12 @@ jobs:
--token "${{ secrets.OC3_EXTENSION_RELEASE_TOKEN }}"
# ------------------------------------------------------------
# 6. Create/force-update release (like OpenCart)
# 6. Create (or forceupdate) release
# ------------------------------------------------------------
- name: Create release
run: |
TAG="v${VERSION}"
tea release create "$TAG" \
--title "${SLUG}_${VERSION}" \
tea release create "$VERSION" \
--title "${PLUGIN_NAME}_${VERSION}" \
--asset "${FILENAME}" \
--repo "${{ vars.GITEA_REPO }}" \
--force