update
Build WordPress Plugin (Simple) / build-release (push) Failing after 22s

This commit is contained in:
Mohamed Youssef
2026-08-02 10:07:36 +03:00
parent 5b9ad90ed7
commit 4e54ecf721
+19 -27
View File
@@ -16,66 +16,58 @@ jobs:
- name: Install zip - name: Install zip
run: sudo apt-get update && sudo apt-get install -y zip run: sudo apt-get update && sudo apt-get install -y zip
# ----------------------------------------------------------------- # ------------------------------------------------------------
# 1. Find the main plugin file and extract slug & version # 1. Find main plugin file (recursively) & extract slug/version
# ----------------------------------------------------------------- # ------------------------------------------------------------
- name: Extract plugin metadata - name: Extract plugin metadata
id: meta id: meta
run: | run: |
# Find the file that contains "Plugin Name:" MAIN_FILE=$(find . -maxdepth 3 -type f -name "*.php" -exec grep -l "Plugin Name:" {} \; | head -n1)
MAIN_FILE=$(grep -rl "Plugin Name:" *.php | head -n1)
if [ -z "$MAIN_FILE" ]; then if [ -z "$MAIN_FILE" ]; then
echo "❌ No plugin file with 'Plugin Name:' found!" >&2 echo "❌ No plugin file with 'Plugin Name:' found!" >&2
exit 1 exit 1
fi fi
MAIN_FILE=${MAIN_FILE#./}
# Extract version (strip trailing newline)
VERSION=$(grep "^Version:" "$MAIN_FILE" | awk '{print $NF}' | tr -d '\r') VERSION=$(grep "^Version:" "$MAIN_FILE" | awk '{print $NF}' | tr -d '\r')
if [ -z "$VERSION" ]; then if [ -z "$VERSION" ]; then
echo "❌ Version not found in $MAIN_FILE" >&2 echo "❌ Version not found in $MAIN_FILE" >&2
exit 1 exit 1
fi fi
# Use repository name as the slug (or override with a custom variable)
SLUG="${GITHUB_REPOSITORY##*/}" SLUG="${GITHUB_REPOSITORY##*/}"
echo "SLUG=$SLUG" >> $GITHUB_ENV echo "SLUG=$SLUG" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "FILENAME=${SLUG}-${VERSION}.zip" >> $GITHUB_ENV echo "FILENAME=${SLUG}-${VERSION}.zip" >> $GITHUB_ENV
echo "✅ Plugin: $SLUG, Version: $VERSION (main file: $MAIN_FILE)"
echo "✅ Plugin: $SLUG, Version: $VERSION" # ------------------------------------------------------------
# 2. Prepare package copy everything except .git and .github
# ----------------------------------------------------------------- # ------------------------------------------------------------
# 2. Prepare the package (copy everything except .git and .github)
# -----------------------------------------------------------------
- name: Prepare package - name: Prepare package
run: | run: |
mkdir -p build/"$SLUG" mkdir -p build/"$SLUG"
# Copy all files, but exclude git and github folders (optional)
rsync -a --exclude='.git' --exclude='.github' ./ build/"$SLUG"/ rsync -a --exclude='.git' --exclude='.github' ./ build/"$SLUG"/
# If you want to exclude node_modules, vendor, etc., add more --exclude's
# ----------------------------------------------------------------- # ------------------------------------------------------------
# 3. Build the zip # 3. Build the zip
# ----------------------------------------------------------------- # ------------------------------------------------------------
- name: Build plugin zip - name: Build plugin zip
run: | run: |
cd build cd build
zip -r "../$FILENAME" "$SLUG" zip -r "../$FILENAME" "$SLUG"
cd .. cd ..
# ----------------------------------------------------------------- # ------------------------------------------------------------
# 4. Install tea CLI # 4. Install tea CLI
# ----------------------------------------------------------------- # ------------------------------------------------------------
- name: Install tea CLI - name: Install tea CLI
run: | run: |
curl -L https://dl.gitea.io/tea/main/tea-main-linux-amd64 -o tea curl -L https://dl.gitea.io/tea/main/tea-main-linux-amd64 -o tea
chmod +x tea chmod +x tea
sudo mv tea /usr/local/bin/ sudo mv tea /usr/local/bin/
# ----------------------------------------------------------------- # ------------------------------------------------------------
# 5. Configure tea (using your existing variables) # 5. Configure tea (using your existing variables)
# ----------------------------------------------------------------- # ------------------------------------------------------------
- name: Configure tea - name: Configure tea
run: | run: |
tea login add \ tea login add \
@@ -83,9 +75,9 @@ jobs:
--url "${{ vars.SERVER_URL }}" \ --url "${{ vars.SERVER_URL }}" \
--token "${{ secrets.OC3_EXTENSION_RELEASE_TOKEN }}" --token "${{ secrets.OC3_EXTENSION_RELEASE_TOKEN }}"
# ----------------------------------------------------------------- # ------------------------------------------------------------
# 6. Create/force-update release # 6. Create/force-update release (like OpenCart)
# ----------------------------------------------------------------- # ------------------------------------------------------------
- name: Create release - name: Create release
run: | run: |
TAG="v${VERSION}" TAG="v${VERSION}"
@@ -93,4 +85,4 @@ jobs:
--title "${SLUG}_${VERSION}" \ --title "${SLUG}_${VERSION}" \
--asset "${FILENAME}" \ --asset "${FILENAME}" \
--repo "${{ vars.GITEA_REPO }}" \ --repo "${{ vars.GITEA_REPO }}" \
--force # <-- overwrites if tag exists --force