This commit is contained in:
@@ -16,66 +16,58 @@ jobs:
|
||||
- name: Install 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
|
||||
id: meta
|
||||
run: |
|
||||
# Find the file that contains "Plugin Name:"
|
||||
MAIN_FILE=$(grep -rl "Plugin Name:" *.php | head -n1)
|
||||
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
|
||||
|
||||
# Extract version (strip trailing newline)
|
||||
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
|
||||
|
||||
# Use repository name as the slug (or override with a custom variable)
|
||||
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)"
|
||||
|
||||
echo "✅ Plugin: $SLUG, Version: $VERSION"
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# 2. Prepare the package (copy everything except .git and .github)
|
||||
# -----------------------------------------------------------------
|
||||
# ------------------------------------------------------------
|
||||
# 2. Prepare package – copy everything except .git and .github
|
||||
# ------------------------------------------------------------
|
||||
- name: Prepare package
|
||||
run: |
|
||||
mkdir -p build/"$SLUG"
|
||||
# Copy all files, but exclude git and github folders (optional)
|
||||
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
|
||||
# -----------------------------------------------------------------
|
||||
# ------------------------------------------------------------
|
||||
- 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 \
|
||||
@@ -83,9 +75,9 @@ jobs:
|
||||
--url "${{ vars.SERVER_URL }}" \
|
||||
--token "${{ secrets.OC3_EXTENSION_RELEASE_TOKEN }}"
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# 6. Create/force-update release
|
||||
# -----------------------------------------------------------------
|
||||
# ------------------------------------------------------------
|
||||
# 6. Create/force-update release (like OpenCart)
|
||||
# ------------------------------------------------------------
|
||||
- name: Create release
|
||||
run: |
|
||||
TAG="v${VERSION}"
|
||||
@@ -93,4 +85,4 @@ jobs:
|
||||
--title "${SLUG}_${VERSION}" \
|
||||
--asset "${FILENAME}" \
|
||||
--repo "${{ vars.GITEA_REPO }}" \
|
||||
--force # <-- overwrites if tag exists
|
||||
--force
|
||||
Reference in New Issue
Block a user