update
Build WordPress Plugin for Gitea / build-release (push) Failing after 9s

This commit is contained in:
Mohamed Youssef
2026-08-02 09:44:57 +03:00
parent ee4f96656b
commit b8674dc363
+8 -17
View File
@@ -57,25 +57,23 @@ jobs:
- name: Get plugin version and slug - name: Get plugin version and slug
id: meta id: meta
run: | run: |
MAIN_FILE=$(grep -l "Plugin Name:" *.php | head -n 1) MAIN_FILE=$(find . -maxdepth 3 -type f -name "*.php" -exec grep -l "Plugin Name:" {} \; | head -n 1)
if [ -z "$MAIN_FILE" ]; then if [ -z "$MAIN_FILE" ]; then
echo "❌ No main 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#./}
VERSION=$(grep "^Version:" "$MAIN_FILE" | awk -F' ' '{print $NF}' | tr -d '\r') VERSION=$(grep "^Version:" "$MAIN_FILE" | awk -F' ' '{print $NF}' | tr -d '\r')
if [ -z "$VERSION" ]; then if [ -z "$VERSION" ]; then
echo "❌ Version header not found in $MAIN_FILE" >&2 echo "❌ Version header not found in $MAIN_FILE" >&2
exit 1 exit 1
fi fi
# Use repository name as the plugin slug
SLUG="${GITHUB_REPOSITORY##*/}" SLUG="${GITHUB_REPOSITORY##*/}"
echo "PLUGIN_SLUG=$SLUG" >> $GITHUB_ENV echo "PLUGIN_SLUG=$SLUG" >> $GITHUB_ENV
echo "PLUGIN_VERSION=$VERSION" >> $GITHUB_ENV echo "PLUGIN_VERSION=$VERSION" >> $GITHUB_ENV
echo "FILENAME=${SLUG}-${VERSION}.zip" >> $GITHUB_ENV echo "FILENAME=${SLUG}-${VERSION}.zip" >> $GITHUB_ENV
echo "✅ Plugin: $SLUG, Version: $VERSION" echo "MAIN_FILE=$MAIN_FILE" >> $GITHUB_ENV
echo "✅ Plugin: $SLUG, Version: $VERSION (main file: $MAIN_FILE)"
# -------------------------------- # --------------------------------
# Prepare package (exclude dev files) # Prepare package (exclude dev files)
@@ -83,8 +81,6 @@ jobs:
- name: Prepare package directory - name: Prepare package directory
run: | run: |
mkdir -p /tmp/build/${{ env.PLUGIN_SLUG }} mkdir -p /tmp/build/${{ env.PLUGIN_SLUG }}
# If you have a .distignore file, use: --exclude-from='.distignore'
rsync -av \ rsync -av \
--exclude='.git' \ --exclude='.git' \
--exclude='.github' \ --exclude='.github' \
@@ -107,10 +103,8 @@ jobs:
--exclude='.wordpress-org' \ --exclude='.wordpress-org' \
./ /tmp/build/${{ env.PLUGIN_SLUG }}/ 2>/dev/null || true ./ /tmp/build/${{ env.PLUGIN_SLUG }}/ 2>/dev/null || true
# Adjust excludes if your plugin needs any of these files in production.
# -------------------------------- # --------------------------------
# Create ZIP archive # Create ZIP
# -------------------------------- # --------------------------------
- name: Create plugin zip - name: Create plugin zip
run: | run: |
@@ -122,7 +116,7 @@ jobs:
# -------------------------------- # --------------------------------
# Install & configure tea CLI # Install & configure tea CLI
# -------------------------------- # --------------------------------
- name: Install tea CLI (pinned version) - name: Install tea CLI
run: | run: |
curl -L https://dl.gitea.io/tea/0.11.0/tea-0.11.0-linux-amd64 -o tea curl -L https://dl.gitea.io/tea/0.11.0/tea-0.11.0-linux-amd64 -o tea
chmod +x tea chmod +x tea
@@ -136,18 +130,15 @@ jobs:
--token "${{ secrets.GITEA_TOKEN }}" --token "${{ secrets.GITEA_TOKEN }}"
# -------------------------------- # --------------------------------
# Create or forceupdate Gitea release # Create/forceupdate Gitea release
# -------------------------------- # --------------------------------
- name: Create/update Gitea release - name: Create/update Gitea release
run: | run: |
TAG="v${{ env.PLUGIN_VERSION }}" TAG="v${{ env.PLUGIN_VERSION }}"
REPO="${{ vars.GITEA_REPO }}" REPO="${{ vars.GITEA_REPO }}"
# --force will overwrite an existing release with the same tag
tea release create "$TAG" \ tea release create "$TAG" \
--title "${{ env.PLUGIN_SLUG }} v${{ env.PLUGIN_VERSION }}" \ --title "${{ env.PLUGIN_SLUG }} v${{ env.PLUGIN_VERSION }}" \
--asset "${{ env.FILENAME }}" \ --asset "${{ env.FILENAME }}" \
--repo "$REPO" \ --repo "$REPO" \
--force --force
echo "✅ Release $TAG created/updated with asset ${{ env.FILENAME }}" echo "✅ Release $TAG created/updated with asset ${{ env.FILENAME }}"