Skip to content

Commit

Permalink
Merge pull request #10 from tarosky/feature/update-wp6.5
Browse files Browse the repository at this point in the history
Feature/update wp6.5
  • Loading branch information
fumikito authored Apr 10, 2024
2 parents ab08cdd + 3024d10 commit 6933469
Show file tree
Hide file tree
Showing 16 changed files with 269 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"Vue": false
},
"extends": [
"plugin:@wordpress/eslint-plugin/recommended"
"plugin:@wordpress/eslint-plugin/recommended-with-formatting"
],
"rules": {
"no-alert": "off",
Expand Down
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
82 changes: 33 additions & 49 deletions .github/workflows/wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,82 +12,66 @@ on:

jobs:
test:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-18.04 ] # OS. ubuntu-18.04 is also available.
php: [ '5.6', '7.2', '7.4' ] # PHP versions to check.
wp: [ 'latest', '5.4' ] # WordPress version to check.
services:
mysql:
image: mysql:5.7
options: --health-cmd "mysqladmin ping --host 127.0.0.1 --port 3306" --health-interval 20s --health-timeout 10s --health-retries 10
ports:
- 3306/tcp
env:
MYSQL_ROOT_PASSWORD: root
name: WordPress ${{ matrix.wp }} in PHP ${{ matrix.php }} UnitTest
steps:
- uses: actions/checkout@master

- name: Setup PHP
uses: nanasess/setup-php@master
with:
php-version: ${{ matrix.php }}

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Start MySQL
run: sudo systemctl start mysql

- name: Install WordPress
run: bash bin/install-wp-tests.sh wordpress root root 127.0.0.1:3306 ${{ matrix.wp }}

- name: Check PHP syntax
run: composer test
uses: tarosky/workflows/.github/workflows/phpcs.yml@main
with:
version: 7.2

assets:
name: Assets Test
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@main

- name: Install Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12'
node-version: '16'

- name: Install NPM Packages
run: npm install

- name: Check JS & CSS syntax
run: npm run lint

phplint:
uses: tarosky/workflows/.github/workflows/phplint.yml@main

release:
name: Deploy WordPress.org
needs: [ test, assets ]
needs: [ test, assets, phplint ]
if: contains(github.ref, 'tags/')
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@main

- name: Setup PHP
uses: nanasess/setup-php@master
uses: shivammathur/setup-php@v2
with:
php-version: 5.6
php-version: 7.2
tools: composer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12'
node-version: '16'

- name: Build Plugin
run: bash bin/build.sh ${{ github.ref }}
run: |
composer install --prefer-dist --no-dev
npm install
npm run package
- name: Generate readme.txt
uses: tarosky/workflows/actions/wp-readme@main

- name: Versioning
uses: tarosky/workflows/actions/versioning@main
with:
version: ${{ github.ref }}
files: readme.txt,taro-series.php

- name: Deploy to WordPress Directory
id: deploy
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/wp-outdated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Latest WP Support

on:
schedule:
- cron: "0 2 5 * *" # Every month on the 5th at 2am UTC

jobs:
is-outdated:
name: Check if WP version is outdated
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main

- name: Install Node
uses: actions/setup-node@master
with:
node-version: '18'

- name: Check wp version
uses: tarosky/farmhand-wp-aciton@v1
id: wp_version

- name: Update Issue if needed
if: steps.wp_version.outputs.should_update
uses: actions-ecosystem/action-create-issue@v1
with:
github_token: ${{ secrets.github_token }}
title: ${{ steps.wp_version.outputs.version }}
body: |
## TODO
- [ ] Check if plugin works with the latest WP version
- [ ] Bump "Tested up to" version in README.md
labels: |
update
assignees: |
user1
File renamed without changes
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Tags: series, posts, news
Contributors: tarosky, Takahashi_Fumiki
Tested up to: 5.8
Requires at least: 5.4
Requires PHP: 5.6
Tested up to: 6.5
Requires at least: 5.9
Requires PHP: 7.2
Stable Tag: nightly
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
Expand Down Expand Up @@ -75,6 +75,12 @@ Create a new [issue](https://github.com/tarosky/taro-series/issues) or send [pul

## Changelog

### 2.0.0

* Add WP_Query orderby parameter `series-updated`.
* Bump minimum PHP requiremtns to PHP 7.2 and over.
* Bump minimum WordPress version to 5.9.

### 1.1.2

* Fix bug in articles count.
Expand Down
31 changes: 14 additions & 17 deletions assets/js/post-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ const { __ } = wp.i18n;
const { apiFetch } = wp;

class SeriesRender extends Component {

constructor(prop) {
super(prop);
constructor( prop ) {
super( prop );
this.state = {
loading: false,
post: null,
Expand Down Expand Up @@ -43,11 +42,11 @@ class SeriesRender extends Component {
loading: true,
}, () => {
apiFetch( {
path: `taro-series/v1/available/${this.props.postType}?p=${postId}`,
path: `taro-series/v1/available/${ this.props.postType }?p=${ postId }`,
} ).then( ( res ) => {
this.setState( {
loading: false,
post: res[0],
post: res[ 0 ],
}, () => {
this.fetching = false;
} );
Expand All @@ -59,7 +58,7 @@ class SeriesRender extends Component {
this.fetching = false;
} );
} );
});
} );
} else {
this.setState( {
post: null,
Expand All @@ -76,7 +75,7 @@ class SeriesRender extends Component {
let link = false;
let title = '';
if ( post ) {
link = post.edit_link;
link = post.edit_link;
title = post.title;
} else if ( 0 < this.props.postId ) {
title = __( 'Loading…', 'taro-series' );
Expand All @@ -100,7 +99,7 @@ class SeriesRender extends Component {
<a style={ style } href={ link } target="_blank" rel="noopener noreferrer">{ title }</a><br />
<Button isSmall isDestructive onClick={ () => {
onChange( 0 );
}}>{ __( 'Leave Out', 'taro-series' ) }</Button>
} }>{ __( 'Leave Out', 'taro-series' ) }</Button>
</>
) : (
<span style={ style } className="taro-series-link taro-series-link-invalid">{ title }</span>
Expand All @@ -112,9 +111,8 @@ class SeriesRender extends Component {
}

class SeriesChooser extends Component {

constructor(props) {
super(props);
constructor( props ) {
super( props );
this.state = {
loading: false,
posts: [],
Expand All @@ -138,7 +136,7 @@ class SeriesChooser extends Component {
fetch() {
this.setState( { loading: true }, () => {
apiFetch( {
path: `taro-series/v1/available/${this.props.postType}?s=${this.state.s}`,
path: `taro-series/v1/available/${ this.props.postType }?s=${ this.state.s }`,
} ).then( ( res ) => {
this.setState( {
loading: false,
Expand Down Expand Up @@ -174,7 +172,7 @@ class SeriesChooser extends Component {
value: parseInt( p.id, 10 ),
label: p.title,
} );
} )
} );
result.push(
<RadioControl label={ __( 'Select Series assigned to', 'taro-series' ) } selected={ currentValue } onChange={ onChange } options={ options } />
);
Expand All @@ -201,9 +199,8 @@ class SeriesChooser extends Component {
}

class SeriesSelector extends Component {

constructor(props) {
super(props);
constructor( props ) {
super( props );
this.state = {
postId: parseInt( props.postId, 10 ),
};
Expand All @@ -230,5 +227,5 @@ class SeriesSelector extends Component {
// If meta box exists.
const metaBox = document.getElementById( 'taro-series-selector' );
if ( metaBox ) {
render( <SeriesSelector postId={ metaBox.dataset.postId } postType={ metaBox.dataset.postType} />, metaBox );
render( <SeriesSelector postId={ metaBox.dataset.postId } postType={ metaBox.dataset.postType } />, metaBox );
}
Loading

0 comments on commit 6933469

Please sign in to comment.