Skip to content

added detailed banner for rankmath #223

added detailed banner for rankmath

added detailed banner for rankmath #223

Workflow file for this run

name: CI/CD
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
workflow_dispatch:
jobs:
php-lint:
name: PHP Lint & CodeSniffer
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: composer:v2
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHP Syntax Check
run: find backend/src -name "*.php" -exec php -l {} \;
- name: Install PHPCS and WordPress Coding Standards
run: |
composer require --dev squizlabs/php_codesniffer wp-coding-standards/wpcs --no-interaction
vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs
- name: Run PHPCS
run: vendor/bin/phpcs
frontend-lint-build:
name: Frontend Lint & Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18', '20', '22']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Configure npm authentication
working-directory: frontend
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies
working-directory: frontend
run: npm ci
- name: Run ESLint
working-directory: frontend
run: npm run lint
- name: Check code formatting
working-directory: frontend
run: npm run format:check
- name: Build WordPress bundle
working-directory: frontend
run: npm run build
- name: Build standalone bundle
working-directory: frontend
run: npm run build:standalone
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts-node-${{ matrix.node-version }}
path: |
frontend/build/
frontend/standalone/
retention-days: 7
security-audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Configure npm authentication
working-directory: frontend
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies
working-directory: frontend
run: npm ci
- name: Run npm audit
working-directory: frontend
run: npm audit --audit-level=moderate
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:v2
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress
- name: Run Composer audit
run: composer audit
package-validation:
name: Package Validation
runs-on: ubuntu-latest
needs: [php-lint, frontend-lint-build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:v2
- name: Configure npm authentication
working-directory: frontend
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies
run: |
cd frontend && npm ci && cd ..
composer install --prefer-dist --no-progress
- name: Build frontend
working-directory: frontend
run: |
npm run build
npm run build:standalone
- name: Validate package structure
run: |
# Check required directories exist
test -d backend/src || exit 1
test -d frontend/build || exit 1
test -d frontend/standalone || exit 1
test -d assets || exit 1
# Check required files exist
test -f composer.json || exit 1
test -f frontend/package.json || exit 1
test -f readme.md || exit 1
echo "✅ Package structure validation passed"
release:
name: Create Release
runs-on: ubuntu-latest
needs: [php-lint, frontend-lint-build, security-audit, package-validation]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:v2
- name: Configure npm authentication
working-directory: frontend
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies and build
run: |
cd frontend && npm ci && cd ..
composer install --no-dev --prefer-dist --optimize-autoloader
cd frontend && npm run build && npm run build:standalone && cd ..
- name: Get version from package.json
id: package-version
run: |
VERSION=$(node -p "require('./frontend/package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check-tag
run: |
if git rev-parse "v${{ steps.package-version.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Create Release Archive
if: steps.check-tag.outputs.exists == 'false'
run: |
mkdir -p release
rsync -av --exclude-from='.gitignore' \
--exclude='.git' \
--exclude='.github' \
--exclude='.idea' \
--exclude='node_modules' \
--exclude='frontend/node_modules' \
--exclude='release' \
--exclude='.DS_Store' \
. release/wp-marketplace/
cd release && zip -r wp-marketplace-${{ steps.package-version.outputs.version }}.zip wp-marketplace/
- name: Create GitHub Release
if: steps.check-tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.package-version.outputs.version }}
name: Release v${{ steps.package-version.outputs.version }}
draft: false
prerelease: ${{ contains(steps.package-version.outputs.version, 'beta') || contains(steps.package-version.outputs.version, 'alpha') }}
files: release/wp-marketplace-${{ steps.package-version.outputs.version }}.zip
generate_release_notes: true