Initial commit of WordPress Plugin Starter Template for AI Coding
Some checks failed
Tests / PHP 7.0 (push) Has been cancelled
Tests / PHP 7.4 (push) Has been cancelled
Tests / PHP 8.0 (push) Has been cancelled
Tests / Code Style (push) Has been cancelled
Sync Wiki / Sync Wiki to GitHub (push) Has been cancelled
Release / Build and Release (push) Has been cancelled

This commit is contained in:
2025-04-18 03:09:39 +01:00
commit c7b590870c
46 changed files with 3198 additions and 0 deletions

66
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,66 @@
name: Release
on:
push:
tags:
- 'v*'
- 'v*-stable'
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl, zip
tools: composer:v2
- name: Get tag name
id: get_tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Extract version from tag
id: get_version
run: |
VERSION=$(echo ${{ env.TAG }} | sed 's/^v//' | sed 's/-stable$//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Install dependencies
run: composer install --no-dev --optimize-autoloader
- name: Create build directory
run: |
mkdir -p build/wp-plugin-starter-template
cp -R *.php README.md LICENSE CHANGELOG.md readme.txt composer.json build/wp-plugin-starter-template/
cp -R admin includes languages vendor build/wp-plugin-starter-template/
mkdir -p build/wp-plugin-starter-template/assets/banner build/wp-plugin-starter-template/assets/icon build/wp-plugin-starter-template/assets/screenshots
if [ -d "assets/banner" ]; then cp -R assets/banner/* build/wp-plugin-starter-template/assets/banner/; fi
if [ -d "assets/icon" ]; then cp -R assets/icon/* build/wp-plugin-starter-template/assets/icon/; fi
if [ -d "assets/screenshots" ]; then cp -R assets/screenshots/* build/wp-plugin-starter-template/assets/screenshots/; fi
- name: Create ZIP file
run: |
cd build
zip -r ../wp-plugin-starter-template-${{ env.VERSION }}.zip wp-plugin-starter-template -x "*.DS_Store" -x "*.git*"
cd ..
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: wp-plugin-starter-template-${{ env.VERSION }}.zip
name: Version ${{ env.VERSION }}
draft: false
prerelease: false
body: |
Release of version ${{ env.VERSION }}
See [CHANGELOG.md](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/blob/main/CHANGELOG.md) for details.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

51
.github/workflows/sync-wiki.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Sync Wiki
on:
push:
branches:
- main
paths:
- '.wiki/**'
jobs:
sync-wiki:
name: Sync Wiki to GitHub
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
- name: Clone wiki repository
run: |
git clone https://github.com/${{ github.repository }}.wiki.git wiki
- name: Sync wiki content
run: |
# Remove all files from wiki repository except .git
find wiki -mindepth 1 -maxdepth 1 -not -name '.git' -exec rm -rf {} \;
# Copy .wiki content to wiki repository
cp -r .wiki/* wiki/
# Go to wiki repository
cd wiki
# Add all changes
git add .
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
# Commit changes
git commit -m "Sync wiki from source repository"
# Push changes
git push https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git

53
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: PHP ${{ matrix.php-versions }}
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.0', '7.4', '8.0']
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, zip
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run tests
run: ./vendor/bin/phpunit
code-style:
name: Code Style
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl, zip
tools: composer:v2, phpcs
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run PHPCS
run: ./vendor/bin/phpcs --standard=WordPress