Skip to content

Initial commit

Initial commit #1

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ['v*']
pull_request:
jobs:
lint:
name: Lint (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.0', '8.2', '8.3']
steps:
- uses: actions/checkout@v5
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
coverage: none
- name: Syntax check
run: find . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n1 -P4 php -l
- name: Install PHPCS with WordPress standards
if: matrix.php == '8.2'
run: |
composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require --no-interaction --no-progress wp-coding-standards/wpcs:^3.1 dealerdirect/phpcodesniffer-composer-installer:^1.0
- name: PHPCS
if: matrix.php == '8.2'
run: |
"$(composer global config bin-dir --absolute --quiet)/phpcs" --standard=phpcs.xml.dist
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
needs: lint
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Build archive
run: bin/build.sh
- name: Verify tag matches plugin version
run: |
SLUG="$(basename "$PWD")"
VERSION="$(sed -nE 's/^[[:space:]]*\*[[:space:]]*Version:[[:space:]]*([0-9][^[:space:]]*).*/\1/p' "$SLUG.php" | head -n1)"
TAG="${GITHUB_REF_NAME#v}"
if [ "$VERSION" != "$TAG" ]; then
echo "Plugin version $VERSION does not match tag $TAG" >&2
exit 1
fi
- uses: softprops/action-gh-release@v3
with:
files: '*.zip'
generate_release_notes: true