refactor: update Aggressive Apparel Logo block for improved structure⦠#82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline (Optimized) | |
| on: | |
| push: | |
| branches: [main, master, develop] | |
| pull_request: | |
| branches: [main, master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| security-events: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| THEME_SLUG: Aggressive-Apparel | |
| NODE_VERSION: '22' | |
| PNPM_VERSION: '9' | |
| PHP_VERSION: '8.2' | |
| jobs: | |
| # ============================================================================ | |
| # JOB 1: Setup Dependencies (Runs once, shared by all jobs) | |
| # ============================================================================ | |
| setup: | |
| name: π¦ Setup Dependencies | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| pnpm-cache-key: ${{ steps.pnpm-cache.outputs.cache-hit }} | |
| composer-cache-key: ${{ steps.composer-cache.outputs.cache-hit }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Get pnpm store directory | |
| id: pnpm-store | |
| shell: bash | |
| run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - name: Cache pnpm dependencies | |
| id: pnpm-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install pnpm dependencies | |
| if: steps.pnpm-cache.outputs.cache-hit != 'true' | |
| run: pnpm install --frozen-lockfile --prefer-offline | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| tools: composer:v2 | |
| - name: Get Composer cache directory | |
| id: composer-cache-dir | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache Composer dependencies | |
| id: composer-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ steps.composer-cache-dir.outputs.dir }} | |
| vendor | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Install Composer dependencies | |
| if: steps.composer-cache.outputs.cache-hit != 'true' | |
| run: composer install --no-interaction --prefer-dist --no-progress | |
| - name: Cache node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| - name: Cache vendor | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }} | |
| # ============================================================================ | |
| # PARALLEL JOBS: Quality Checks (Fast fail) | |
| # ============================================================================ | |
| lint-js: | |
| name: π Lint JavaScript | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Restore pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.local/share/pnpm/store/v3 | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| - name: Restore node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| - name: Install dependencies (if cache miss) | |
| run: pnpm install --frozen-lockfile --offline || pnpm install --frozen-lockfile | |
| - name: Run ESLint | |
| run: pnpm lint:js | |
| - name: Run Prettier | |
| run: pnpm format:check | |
| lint-php: | |
| name: π Lint PHP | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| tools: composer:v2 | |
| - name: Restore Composer cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }} | |
| - name: Install dependencies (if cache miss) | |
| run: composer install --no-interaction --prefer-dist || true | |
| - name: PHP Syntax Check | |
| run: find includes/ -name "*.php" -exec php -l {} \; > /dev/null && echo "β PHP syntax valid" | |
| phpcs: | |
| name: π PHPCS | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| tools: composer:v2 | |
| - name: Restore Composer cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }} | |
| - name: Install dependencies (if cache miss) | |
| run: composer install --no-interaction --prefer-dist || true | |
| - name: Run PHPCS | |
| run: ./vendor/bin/phpcs --standard=phpcs.xml.dist includes/ src/ | |
| phpstan: | |
| name: π PHPStan | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| tools: composer:v2 | |
| - name: Restore Composer cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }} | |
| - name: Install dependencies (if cache miss) | |
| run: composer install --no-interaction --prefer-dist || true | |
| - name: Run PHPStan | |
| run: ./vendor/bin/phpstan analyse --memory-limit=2G --verbose | |
| # ============================================================================ | |
| # JOB: Check if release-worthy (Conditional build trigger) | |
| # ============================================================================ | |
| check-release-trigger: | |
| name: π Check Release Trigger | |
| runs-on: ubuntu-latest | |
| needs: [lint-js, lint-php, phpcs, phpstan] | |
| outputs: | |
| should_build: ${{ steps.check.outputs.should_build }} | |
| timeout-minutes: 2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 5 | |
| - name: Check if commit triggers release | |
| id: check | |
| run: | | |
| echo "Checking latest commits for release triggers..." | |
| # Get the latest commit message | |
| LATEST_COMMIT=$(git log -1 --pretty=format:"%s") | |
| echo "Latest commit: $LATEST_COMMIT" | |
| # Check if commit contains release-triggering keywords | |
| if echo "$LATEST_COMMIT" | grep -qE '^(feat|fix|perf)!?:|^(feat|fix|perf).*BREAKING CHANGE'; then | |
| echo "β Release-triggering commit detected" | |
| echo "should_build=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "βΉοΈ Non-release commit (docs/style/refactor/test/etc)" | |
| echo "should_build=false" >> $GITHUB_OUTPUT | |
| fi | |
| # ============================================================================ | |
| # JOB: Build Assets (Only for release-worthy commits) | |
| # ============================================================================ | |
| build: | |
| name: π¨ Build Assets | |
| runs-on: ubuntu-latest | |
| needs: | |
| [ | |
| check-release-trigger, | |
| lint-js, | |
| lint-php, | |
| phpcs, | |
| phpstan, | |
| test-unit, | |
| test-integration, | |
| test-security, | |
| test-accessibility, | |
| test-performance, | |
| ] | |
| if: needs.check-release-trigger.outputs.should_build == 'true' && success() | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Restore node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| - name: Install dependencies (if cache miss) | |
| run: pnpm install --frozen-lockfile || true | |
| - name: Build assets | |
| run: pnpm build | |
| - name: Cache build artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: build | |
| key: ${{ runner.os }}-build-${{ github.sha }} | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: build/ | |
| retention-days: 7 | |
| # ============================================================================ | |
| # PARALLEL JOBS: Test Suites (Only for release-worthy commits) | |
| # ============================================================================ | |
| test-unit: | |
| name: π§ͺ Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: [check-release-trigger] | |
| if: needs.check-release-trigger.outputs.should_build == 'true' | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| extensions: mbstring, xml, zip, xdebug | |
| coverage: xdebug | |
| - name: Restore caches | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| vendor | |
| node_modules | |
| key: ${{ runner.os }}-deps-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }} | |
| - name: Install dependencies | |
| run: | | |
| composer install --no-interaction --prefer-dist | |
| pnpm install --frozen-lockfile | |
| - name: Start wp-env | |
| run: | | |
| pnpm env:start | |
| sleep 10 | |
| - name: Setup theme directory | |
| run: | | |
| # Create symlink from actual directory to expected theme slug for WordPress | |
| pnpm wp-env run tests-cli -- bash -c " | |
| cd /var/www/html/wp-content/themes/ | |
| if [ -d 'Aggressive-Apparel' ] && [ ! -d 'aggressive-apparel' ]; then | |
| ln -sf Aggressive-Apparel aggressive-apparel | |
| echo 'Created symlink: Aggressive-Apparel -> aggressive-apparel' | |
| fi | |
| " | |
| - name: Install dependencies in wp-env | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && composer install --no-interaction --prefer-dist" | |
| - name: Run unit tests with coverage | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && ./vendor/bin/phpunit --testsuite=unit --coverage-clover=coverage-unit.xml" | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage-unit.xml | |
| flags: unit | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Stop wp-env | |
| if: always() | |
| run: pnpm env:stop | |
| test-integration: | |
| name: π Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: [check-release-trigger] | |
| if: needs.check-release-trigger.outputs.should_build == 'true' | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| extensions: mbstring, xml, zip | |
| - name: Restore caches | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| vendor | |
| node_modules | |
| key: ${{ runner.os }}-deps-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }} | |
| - name: Install dependencies | |
| run: | | |
| composer install --no-interaction --prefer-dist | |
| pnpm install --frozen-lockfile | |
| - name: Start wp-env | |
| run: | | |
| pnpm env:start | |
| sleep 10 | |
| - name: Setup theme directory | |
| run: | | |
| # Create symlink from actual directory to expected theme slug for WordPress | |
| pnpm wp-env run tests-cli -- bash -c " | |
| cd /var/www/html/wp-content/themes/ | |
| if [ -d 'Aggressive-Apparel' ] && [ ! -d 'aggressive-apparel' ]; then | |
| ln -sf Aggressive-Apparel aggressive-apparel | |
| echo 'Created symlink: Aggressive-Apparel -> aggressive-apparel' | |
| fi | |
| " | |
| - name: Install dependencies in wp-env | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && composer install --no-interaction --prefer-dist" | |
| - name: Run integration tests | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && ./vendor/bin/phpunit --testsuite=integration --verbose" | |
| - name: Stop wp-env | |
| if: always() | |
| run: pnpm env:stop | |
| test-security: | |
| name: π Security Tests | |
| runs-on: ubuntu-latest | |
| needs: [check-release-trigger] | |
| if: needs.check-release-trigger.outputs.should_build == 'true' | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| extensions: mbstring, xml, zip | |
| - name: Restore caches | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| vendor | |
| node_modules | |
| key: ${{ runner.os }}-deps-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }} | |
| - name: Install dependencies | |
| run: | | |
| composer install --no-interaction --prefer-dist | |
| pnpm install --frozen-lockfile | |
| - name: Start wp-env | |
| run: | | |
| pnpm env:start | |
| sleep 10 | |
| - name: Setup theme directory | |
| run: | | |
| # Create symlink from actual directory to expected theme slug for WordPress | |
| pnpm wp-env run tests-cli -- bash -c " | |
| cd /var/www/html/wp-content/themes/ | |
| if [ -d 'Aggressive-Apparel' ] && [ ! -d 'aggressive-apparel' ]; then | |
| ln -sf Aggressive-Apparel aggressive-apparel | |
| echo 'Created symlink: Aggressive-Apparel -> aggressive-apparel' | |
| fi | |
| " | |
| - name: Install dependencies in wp-env | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && composer install --no-interaction --prefer-dist" | |
| - name: Run security tests | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && ./vendor/bin/phpunit --testsuite=security --verbose" | |
| - name: Stop wp-env | |
| if: always() | |
| run: pnpm env:stop | |
| test-accessibility: | |
| name: βΏ Accessibility Tests | |
| runs-on: ubuntu-latest | |
| needs: [check-release-trigger] | |
| if: needs.check-release-trigger.outputs.should_build == 'true' | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| extensions: mbstring, xml, zip | |
| - name: Restore caches | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| vendor | |
| node_modules | |
| key: ${{ runner.os }}-deps-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }} | |
| - name: Install dependencies | |
| run: | | |
| composer install --no-interaction --prefer-dist | |
| pnpm install --frozen-lockfile | |
| - name: Start wp-env | |
| run: | | |
| pnpm env:start | |
| sleep 10 | |
| - name: Setup theme directory | |
| run: | | |
| # Create symlink from actual directory to expected theme slug for WordPress | |
| pnpm wp-env run tests-cli -- bash -c " | |
| cd /var/www/html/wp-content/themes/ | |
| if [ -d 'Aggressive-Apparel' ] && [ ! -d 'aggressive-apparel' ]; then | |
| ln -sf Aggressive-Apparel aggressive-apparel | |
| echo 'Created symlink: Aggressive-Apparel -> aggressive-apparel' | |
| fi | |
| " | |
| - name: Install dependencies in wp-env | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && composer install --no-interaction --prefer-dist" | |
| - name: Run accessibility tests | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && ./vendor/bin/phpunit --testsuite=accessibility --verbose" | |
| - name: Stop wp-env | |
| if: always() | |
| run: pnpm env:stop | |
| test-performance: | |
| name: β‘ Performance Tests | |
| runs-on: ubuntu-latest | |
| needs: [check-release-trigger] | |
| if: needs.check-release-trigger.outputs.should_build == 'true' | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| extensions: mbstring, xml, zip | |
| - name: Restore caches | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| vendor | |
| node_modules | |
| key: ${{ runner.os }}-deps-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }} | |
| - name: Install dependencies | |
| run: | | |
| composer install --no-interaction --prefer-dist | |
| pnpm install --frozen-lockfile | |
| - name: Start wp-env | |
| run: | | |
| pnpm env:start | |
| sleep 10 | |
| - name: Setup theme directory | |
| run: | | |
| # Create symlink from actual directory to expected theme slug for WordPress | |
| pnpm wp-env run tests-cli -- bash -c " | |
| cd /var/www/html/wp-content/themes/ | |
| if [ -d 'Aggressive-Apparel' ] && [ ! -d 'aggressive-apparel' ]; then | |
| ln -sf Aggressive-Apparel aggressive-apparel | |
| echo 'Created symlink: Aggressive-Apparel -> aggressive-apparel' | |
| fi | |
| " | |
| - name: Install dependencies in wp-env | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && composer install --no-interaction --prefer-dist" | |
| - name: Run performance tests | |
| run: pnpm wp-env run tests-cli -- bash -c "cd /var/www/html/wp-content/themes/${{ env.THEME_SLUG }} && ./vendor/bin/phpunit --testsuite=performance --verbose" | |
| - name: Stop wp-env | |
| if: always() | |
| run: pnpm env:stop | |
| # ============================================================================ | |
| # JOB: Package (After build and all tests pass) | |
| # ============================================================================ | |
| package: | |
| name: π¦ Package Theme | |
| runs-on: ubuntu-latest | |
| needs: | |
| [ | |
| build, | |
| test-unit, | |
| test-integration, | |
| test-security, | |
| test-accessibility, | |
| test-performance, | |
| ] | |
| if: success() && needs.build.result == 'success' | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Restore build artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: build | |
| key: ${{ runner.os }}-build-${{ github.sha }} | |
| fail-on-cache-miss: true | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| tools: composer:v2 | |
| - name: Install production dependencies | |
| run: composer install --no-dev --optimize-autoloader --no-interaction | |
| - name: Verify build artifacts exist | |
| run: | | |
| echo "π¦ Checking build artifacts..." | |
| ls -la build/ | |
| echo "β Build artifacts verified" | |
| - name: Clean development files | |
| run: | | |
| echo "π§Ή Removing development files..." | |
| # Remove directories | |
| rm -rf node_modules src tests .github .husky .vscode bin | |
| # Remove lock files | |
| rm -f pnpm-lock.yaml composer.lock | |
| # Remove config files | |
| rm -f webpack.* tsconfig.* eslint.config.js .stylelintrc.json postcss.config.cjs | |
| rm -f phpunit.xml* phpstan.* phpcs.xml* commitlint.config.mjs .releaserc.json | |
| rm -f jest.config.mjs | |
| # Remove specific dotfiles | |
| rm -f .wp-env.json .editorconfig .gitignore .gitattributes | |
| # Remove dev dependency files | |
| rm -f package.json composer.json | |
| echo "β Development files removed" | |
| - name: Create theme package | |
| run: | | |
| echo "π¦ Creating theme package..." | |
| # Use lowercase name for WordPress theme directory inside ZIP | |
| THEME_SLUG_LOWER=$(echo "${{ env.THEME_SLUG }}" | tr '[:upper:]' '[:lower:]') | |
| # Create temp directory for packaging | |
| TEMP_DIR="${{ env.THEME_SLUG }}-temp" | |
| mkdir -p "../${TEMP_DIR}/${THEME_SLUG_LOWER}" | |
| # Copy all files to temp directory with lowercase directory name | |
| cp -r * "../${TEMP_DIR}/${THEME_SLUG_LOWER}/" | |
| # Create zip from temp directory | |
| cd "../${TEMP_DIR}" | |
| zip -r "${THEME_SLUG_LOWER}.zip" "${THEME_SLUG_LOWER}" \ | |
| -x "**/.git/*" \ | |
| -x "**/.DS_Store" \ | |
| -x "**/Thumbs.db" | |
| # Move zip back to original directory | |
| mv "${THEME_SLUG_LOWER}.zip" "../${{ env.THEME_SLUG }}/" | |
| # Clean up temp directory | |
| cd .. | |
| rm -rf "${TEMP_DIR}" | |
| # Return to theme directory | |
| cd ${{ env.THEME_SLUG }} | |
| echo "β Package created: $(ls -lh aggressive-apparel.zip)" | |
| - name: Upload theme package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.THEME_SLUG }}-package | |
| path: aggressive-apparel.zip | |
| retention-days: 30 | |
| # ============================================================================ | |
| # JOB: Release (Only on main/master) | |
| # ============================================================================ | |
| release: | |
| name: π Release | |
| runs-on: ubuntu-latest | |
| needs: [package] | |
| if: success() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name == 'push' | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Download theme package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.THEME_SLUG }}-package | |
| path: ./ | |
| - name: Verify package exists | |
| run: | | |
| echo "π¦ Verifying package..." | |
| ls -lh aggressive-apparel.zip | |
| echo "β Package verified" | |
| - name: Semantic Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HUSKY: 0 | |
| run: | | |
| echo "π Running semantic release..." | |
| pnpm semantic-release | |
| # ============================================================================ | |
| # Summary | |
| # ============================================================================ | |
| summary: | |
| name: β CI Summary | |
| runs-on: ubuntu-latest | |
| needs: | |
| [ | |
| lint-js, | |
| lint-php, | |
| phpcs, | |
| phpstan, | |
| check-release-trigger, | |
| build, | |
| test-unit, | |
| test-integration, | |
| test-security, | |
| test-accessibility, | |
| test-performance, | |
| package, | |
| ] | |
| if: always() | |
| steps: | |
| - name: Check status | |
| run: | | |
| echo "## π CI/CD Pipeline Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # Check if this was a release-worthy commit | |
| RELEASE_TRIGGER="${{ needs.check-release-trigger.outputs.should_build }}" | |
| if [ "$RELEASE_TRIGGER" = "true" ]; then | |
| echo "π **Release-worthy commit detected** - Full pipeline executed" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "βΉοΈ **Non-release commit** - Only quality checks executed" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| JavaScript Lint | ${{ needs.lint-js.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| PHP Lint | ${{ needs.lint-php.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| PHPCS | ${{ needs.phpcs.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| PHPStan | ${{ needs.phpstan.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Release Check | ${{ needs.check-release-trigger.result }} |" >> $GITHUB_STEP_SUMMARY | |
| # Show build/test status based on release trigger | |
| if [ "$RELEASE_TRIGGER" = "true" ]; then | |
| echo "| Build | ${{ needs.build.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Unit Tests | ${{ needs.test-unit.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Integration Tests | ${{ needs.test-integration.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Security Tests | ${{ needs.test-security.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Accessibility Tests | ${{ needs.test-accessibility.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Performance Tests | ${{ needs.test-performance.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Package | ${{ needs.package.result }} |" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ needs.lint-js.result }}" = "success" ] && \ | |
| [ "${{ needs.test-unit.result }}" = "success" ] && \ | |
| [ "${{ needs.package.result }}" = "success" ]; then | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### β Full pipeline completed successfully!" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| else | |
| echo "| Build | βοΈ Skipped (non-release) |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Tests | βοΈ Skipped (non-release) |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Package | βοΈ Skipped (non-release) |" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ needs.lint-js.result }}" = "success" ]; then | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### β Quality checks passed - Ready for merge!" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| fi |