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: on:
push: push:
@@ -13,39 +13,49 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install zip - name: Install XML tools and zip
run: sudo apt-get update && sudo apt-get install -y 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 id: meta
run: | run: |
MAIN_FILE=$(find . -maxdepth 3 -type f -name "*.php" -exec grep -l "Plugin Name:" {} \; | head -n1) # Ensure plugin.xml exists
if [ -z "$MAIN_FILE" ]; then if [ ! -f plugin.xml ]; then
echo "❌ No plugin file with 'Plugin Name:' found!" >&2 echo "❌ plugin.xml not found!" >&2
exit 1 exit 1
fi fi
MAIN_FILE=${MAIN_FILE#./}
VERSION=$(grep "^Version:" "$MAIN_FILE" | awk '{print $NF}' | tr -d '\r') # Extract name and version (adjust XPath to your XML structure)
if [ -z "$VERSION" ]; then NAME=$(xmllint --xpath "string(//name)" plugin.xml)
echo "❌ Version not found in $MAIN_FILE" >&2 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 exit 1
fi fi
SLUG="${GITHUB_REPOSITORY##*/}"
echo "SLUG=$SLUG" >> $GITHUB_ENV echo "PLUGIN_NAME=$NAME" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "FILENAME=${SLUG}-${VERSION}.zip" >> $GITHUB_ENV echo "FILENAME=${NAME}-${VERSION}.zip" >> $GITHUB_ENV
echo "✅ Plugin: $SLUG, Version: $VERSION (main file: $MAIN_FILE)"
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 - name: Prepare package
run: | run: |
mkdir -p build/"$SLUG" mkdir -p build/"$PLUGIN_NAME"
rsync -a --exclude='.git' --exclude='.github' ./ build/"$SLUG"/ rsync -a \
--exclude='.git' \
--exclude='.github' \
--exclude='plugin.xml' \
./ build/"$PLUGIN_NAME"/
# ------------------------------------------------------------ # ------------------------------------------------------------
# 3. Build the zip # 3. Build the zip
@@ -53,7 +63,7 @@ jobs:
- name: Build plugin zip - name: Build plugin zip
run: | run: |
cd build cd build
zip -r "../$FILENAME" "$SLUG" zip -r "../$FILENAME" "$PLUGIN_NAME"
cd .. cd ..
# ------------------------------------------------------------ # ------------------------------------------------------------
@@ -66,7 +76,7 @@ jobs:
sudo mv tea /usr/local/bin/ sudo mv tea /usr/local/bin/
# ------------------------------------------------------------ # ------------------------------------------------------------
# 5. Configure tea (using your existing variables) # 5. Configure tea
# ------------------------------------------------------------ # ------------------------------------------------------------
- name: Configure tea - name: Configure tea
run: | run: |
@@ -76,13 +86,12 @@ jobs:
--token "${{ secrets.OC3_EXTENSION_RELEASE_TOKEN }}" --token "${{ secrets.OC3_EXTENSION_RELEASE_TOKEN }}"
# ------------------------------------------------------------ # ------------------------------------------------------------
# 6. Create/force-update release (like OpenCart) # 6. Create (or forceupdate) release
# ------------------------------------------------------------ # ------------------------------------------------------------
- name: Create release - name: Create release
run: | run: |
TAG="v${VERSION}" tea release create "$VERSION" \
tea release create "$TAG" \ --title "${PLUGIN_NAME}_${VERSION}" \
--title "${SLUG}_${VERSION}" \
--asset "${FILENAME}" \ --asset "${FILENAME}" \
--repo "${{ vars.GITEA_REPO }}" \ --repo "${{ vars.GITEA_REPO }}" \
--force --force
+4
View File
@@ -0,0 +1,4 @@
<plugin>
<name>Advanced SEO Meta + AI FAQ Schema</name>
<version>3.0.0</version>
</plugin>