Release: 3.5.2 #197
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: GeneratePress CI | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: 'Package name' | |
default: 'generatepress' | |
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/changed-files@v35.4.3 | |
with: | |
files: | | |
src/**/*.js | |
src/**/*.json | |
- name: Setup node | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- name: Download deps | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: bahmutov/npm-install@v1 | |
with: | |
useLockFile: false | |
- 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/changed-files@v35.4.3 | |
with: | |
files: | | |
src/**/*.js | |
src/**/*.json | |
- name: Setup node | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
- 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] | |
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/changed-files@v35.4.3 | |
with: | |
files: | | |
src/**/*.js | |
src/**/*.json | |
- name: Setup node | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- name: Download deps | |
if: steps.js-files.outputs.any_changed == 'true' | |
uses: bahmutov/npm-install@v1 | |
with: | |
useLockFile: false | |
- 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: 'assets/dist/' | |
push: origin HEAD:${{ github.head_ref }} | |
php-lint: | |
name: PHP Lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['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/changed-files@v35.4.3 | |
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 php | |
php-tests: | |
name: PHP Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['7.4'] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check changed files | |
id: 'php-files' | |
uses: tj-actions/changed-files@v35.4.3 | |
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, php-lint] | |
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: 14 | |
- name: Download deps | |
uses: bahmutov/npm-install@v1 | |
with: | |
useLockFile: false | |
- name: Build files | |
run: npm run build | |
- name: Build grunt files | |
run: npm run grunt:build | |
- name: Grunt action-package | |
run: npm run action-package | |
- name: Build zip package | |
uses: actions/upload-artifact@v3.1.0 | |
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 style header | |
run: 'cat style.css | grep -w "Version: ${PR_TITLE:9}"' | |
env: | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
- name: Check PHP constant | |
run: "cat functions.php | grep -w \"define( 'GENERATE_VERSION', '${PR_TITLE:9}' );\"" | |
env: | |
PR_TITLE: ${{ github.event.pull_request.title }} |