Query - Fix offset and post per page in preview #1218
Workflow file for this run
This file contains 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: GenerateBlocks CI | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: 'Package name' | |
default: 'generateblocks' | |
required: true | |
build-package: | |
type: boolean | |
default: false | |
description: Build the zip package | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
- release/** | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
js-lint: | |
name: JS Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check changed files | |
id: 'js-files' | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
**/*.js | |
**/*.json | |
- name: Setup node | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Configure npm for private registry | |
if: steps.js-files.outputs.any_changed == 'true' | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Download deps | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: bahmutov/npm-install@v1 | |
- name: Lint | |
if: steps.js-files.outputs.any_changed == 'true' | |
run: npm run lint:js | |
js-tests: | |
name: JS Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check changed files | |
id: 'js-files' | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
**/*.js | |
**/*.json | |
- name: Setup node | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Configure npm for private registry | |
if: steps.js-files.outputs.any_changed == 'true' | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Download deps | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: bahmutov/npm-install@v1 | |
- name: Run tests | |
if: steps.js-files.outputs.any_changed == 'true' | |
run: npm run test:unit | |
js-commit-dist: | |
name: Commit dist files | |
runs-on: ubuntu-latest | |
needs: [js-lint, js-tests] | |
if: ${{ 'master' == github.ref_name || startsWith(github.ref_name, 'release/') || startsWith(github.head_ref, 'release/') }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check changed files | |
id: 'js-files' | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
**/*.js | |
**/*.json | |
- name: Setup node | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Configure npm for private registry | |
if: steps.js-files.outputs.any_changed == 'true' | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Download deps | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: bahmutov/npm-install@v1 | |
- name: Build files | |
if: steps.js-files.outputs.any_changed == 'true' | |
run: npm run build | |
- name: Commit files | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
message: 'Update dist files' | |
add: 'dist/' | |
push: origin HEAD:${{ github.head_ref }} | |
php-lint: | |
name: PHP Lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['7.2', '7.4', '8.1'] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check changed files | |
id: 'php-files' | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
**/*.php | |
- name: Setup PHP | |
if: steps.php-files.outputs.any_changed == 'true' | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Download deps | |
if: steps.php-files.outputs.any_changed == 'true' | |
uses: ramsey/composer-install@v2 | |
- name: Lint | |
if: steps.php-files.outputs.any_changed == 'true' | |
run: composer run-script lint | |
php-tests: | |
name: PHP Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['7.2'] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check changed files | |
id: 'php-files' | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
**/*.php | |
- name: Setup PHP | |
if: steps.php-files.outputs.any_changed == 'true' | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Download deps | |
if: steps.php-files.outputs.any_changed == 'true' | |
uses: ramsey/composer-install@v2 | |
- name: Test | |
if: steps.php-files.outputs.any_changed == 'true' | |
run: composer run-script test | |
build-package: | |
name: Build package | |
runs-on: ubuntu-latest | |
needs: [js-lint, js-tests, php-lint, php-tests] | |
if: github.event.inputs.build-package == 'true' | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Configure npm for private registry | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Download deps | |
uses: bahmutov/npm-install@v1 | |
with: | |
useLockFile: false | |
- name: Build files | |
run: npm run build | |
- name: Grunt action-package | |
run: npm run action-package | |
- name: Build zip package | |
uses: actions/[email protected] | |
with: | |
name: ${{ github.event.inputs.name }} | |
path: | | |
package/ | |
retention-days: 1 | |
check-version: | |
name: Check versions | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, 'Release:') }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Check readme.txt | |
if: ${{ !contains(github.event.pull_request.title, '-alpha') && !contains(github.event.pull_request.title, '-beta') && !contains(github.event.pull_request.title, '-rc') }} | |
run: 'cat readme.txt | grep -w "Stable tag: ${PR_TITLE:9}"' | |
env: | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
- name: Check package.json | |
run: 'cat package.json | grep -w "\"version\": \"${PR_TITLE:9}\","' | |
env: | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
- name: Check plugin header | |
run: 'cat plugin.php | grep -w " * Version: ${PR_TITLE:9}"' | |
env: | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
- name: Check PHP constant | |
run: "cat plugin.php | grep -w \"define( 'GENERATEBLOCKS_VERSION', '${PR_TITLE:9}' );\"" | |
env: | |
PR_TITLE: ${{ github.event.pull_request.title }} |