Skip to content

Commit

Permalink
Added wp plugin check code
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinc committed Oct 8, 2024
1 parent 33106e9 commit f6fd659
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/ version-bump.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: Version Bump
name: Version Bump and Plugin Check

on:
push:
branches:
- master

jobs:
version-bump:
version-bump-and-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'

- name: Get base version from VERSION.md
id: get_base_version
run: echo "BASE_VERSION=$(cat VERSION.md)" >> $GITHUB_OUTPUT
Expand All @@ -28,10 +33,8 @@ jobs:
latest_tag="${{ steps.get_latest_tag.outputs.LATEST_TAG }}"
if [ "$(printf '%s\n' "$base_version" "$latest_tag" | sort -V | tail -n1)" = "$base_version" ]; then
# Use base version if it's greater
new_version="$base_version"
else
# Increment patch version of latest tag
version=$(echo $latest_tag | sed 's/v//')
IFS='.' read -ra ADDR <<< "$version"
new_patch=$((ADDR[2] + 1))
Expand All @@ -40,14 +43,35 @@ jobs:
echo "NEW_VERSION=$new_version" >> $GITHUB_OUTPUT
- name: Build plugin
run: |
chmod +x build.sh
./build.sh ${{ steps.determine_version.outputs.NEW_VERSION }}
- name: Install WordPress Plugin Check
run: |
composer global require wp-cli/wp-cli-bundle
composer global require wp-cli/checksum-command
composer global require wp-cli/i18n-command
composer global require wp-coding-standards/wpcs
composer global require dealerdirect/phpcodesniffer-composer-installer
composer global require wp-cli/plugin-check-command
- name: Run Plugin Check
run: |
export PATH=$PATH:$HOME/.composer/vendor/bin
wp plugin check dist/betterportal-theme-embedded-${{ steps.determine_version.outputs.NEW_VERSION }}.zip --format=summary
- name: Create and push new tag
if: success()
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag ${{ steps.determine_version.outputs.NEW_VERSION }}
git push origin ${{ steps.determine_version.outputs.NEW_VERSION }}
- name: Trigger build and release
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ on:
- 'v*'

jobs:
build:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'

- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
Expand All @@ -21,7 +26,22 @@ jobs:
chmod +x build.sh
./build.sh ${{ steps.get_version.outputs.VERSION }}
- name: Install WordPress Plugin Check
run: |
composer global require wp-cli/wp-cli-bundle
composer global require wp-cli/checksum-command
composer global require wp-cli/i18n-command
composer global require wp-coding-standards/wpcs
composer global require dealerdirect/phpcodesniffer-composer-installer
composer global require wp-cli/plugin-check-command
- name: Run Plugin Check
run: |
export PATH=$PATH:$HOME/.composer/vendor/bin
wp plugin check dist/betterportal-theme-embedded-${{ steps.get_version.outputs.VERSION }}.zip --format=summary
- name: Create Release
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down

0 comments on commit f6fd659

Please sign in to comment.