Files
advanced-seo-keywords/.gitea/workflows/release.yml
T
Mohamed Youssef 4e54ecf721
Build WordPress Plugin (Simple) / build-release (push) Failing after 22s
update
2026-08-02 10:07:36 +03:00

88 lines
3.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build WordPress Plugin (Simple)
on:
push:
branches:
- main
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install zip
run: sudo apt-get update && sudo apt-get install -y zip
# ------------------------------------------------------------
# 1. Find main plugin file (recursively) & extract slug/version
# ------------------------------------------------------------
- name: Extract plugin metadata
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
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
exit 1
fi
SLUG="${GITHUB_REPOSITORY##*/}"
echo "SLUG=$SLUG" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "FILENAME=${SLUG}-${VERSION}.zip" >> $GITHUB_ENV
echo "✅ Plugin: $SLUG, Version: $VERSION (main file: $MAIN_FILE)"
# ------------------------------------------------------------
# 2. Prepare package copy everything except .git and .github
# ------------------------------------------------------------
- name: Prepare package
run: |
mkdir -p build/"$SLUG"
rsync -a --exclude='.git' --exclude='.github' ./ build/"$SLUG"/
# ------------------------------------------------------------
# 3. Build the zip
# ------------------------------------------------------------
- name: Build plugin zip
run: |
cd build
zip -r "../$FILENAME" "$SLUG"
cd ..
# ------------------------------------------------------------
# 4. Install tea CLI
# ------------------------------------------------------------
- name: Install tea CLI
run: |
curl -L https://dl.gitea.io/tea/main/tea-main-linux-amd64 -o tea
chmod +x tea
sudo mv tea /usr/local/bin/
# ------------------------------------------------------------
# 5. Configure tea (using your existing variables)
# ------------------------------------------------------------
- name: Configure tea
run: |
tea login add \
--name gitea \
--url "${{ vars.SERVER_URL }}" \
--token "${{ secrets.OC3_EXTENSION_RELEASE_TOKEN }}"
# ------------------------------------------------------------
# 6. Create/force-update release (like OpenCart)
# ------------------------------------------------------------
- name: Create release
run: |
TAG="v${VERSION}"
tea release create "$TAG" \
--title "${SLUG}_${VERSION}" \
--asset "${FILENAME}" \
--repo "${{ vars.GITEA_REPO }}" \
--force