diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..d632abe387d802229a8cf427ad99422027490dfe --- /dev/null +++ b/.gitattributes @@ -0,0 +1,35 @@ +# A set of files you probably don't want in your WordPress.org distribution +/.distignore export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.gitlab-ci.yml export-ignore +/.travis.yml export-ignore +/.DS_Store export-ignore +/Thumbs.db export-ignore +/behat.yml export-ignore +/bitbucket-pipelines.yml export-ignore +/bin export-ignore +/.circleci/config.yml export-ignore +/composer.json export-ignore +/composer.lock export-ignore +/Gruntfile.js export-ignore +/package.json export-ignore +/package-lock.json export-ignore +/phpunit.xml export-ignore +/phpunit.xml.dist export-ignore +/multisite.xml export-ignore +/multisite.xml.dist export-ignore +/.phpcs.xml export-ignore +/phpcs.xml export-ignore +/.phpcs.xml.dist export-ignore +/phpcs.xml.dist export-ignore +/README.md export-ignore +/wp-cli.local.yml export-ignore +/yarn.lock export-ignore +/tests export-ignore +/vendor export-ignore +/node_modules export-ignore +/*.sql export-ignore +/*.tar.gz export-ignore +/*.zip export-ignore diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3dbd5135165c1ffee260bbd0a702b1100821a060..9ee66ece3ed22d4ef941612efef52c1f010e67f5 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,6 +26,7 @@ before_script: - phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs,$HOME/.composer/vendor/phpcompatibility/php-compatibility,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-wp PHPunit:PHP7.2:MySQL: + stage: test image: containers.ethitter.com:443/docker/images/php:7.2 services: - mysql:5.6 @@ -35,6 +36,7 @@ PHPunit:PHP7.2:MySQL: - phpunit PHPunit:PHP7.3:MySQL: + stage: test image: containers.ethitter.com:443/docker/images/php:7.3 services: - mysql:5.6 @@ -42,3 +44,14 @@ PHPunit:PHP7.3:MySQL: - find . -type "f" -iname "*.php" | xargs -L "1" php -l - phpcs -n - phpunit + +PluginSVN: + stage: deploy + image: containers.ethitter.com:443/docker/images/php:7.3 + before_script: + - apt-get update + - apt-get install -y rsync + script: ./bin/deploy.sh + when: on_success +# only: +# - master diff --git a/README.md b/README.md index 9da2a7452f86230cdab288669fdfe549f2312aa7..d68ffd2da59602fbe3cf04843d780a2493a3daf5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **Tags:** view all, pages, paged, paged post, multipage, single view, single page, wp_link_pages, nextpage, next page, quicktag **Requires at least:** 3.2.1 **Tested up to:** 5.1 -**Stable tag:** 0.9.1 +**Stable tag:** 0.9.2 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -52,6 +52,7 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an ## Changelog ## ### 0.9.2 ### +* Compatible with PHP 7.3 * Introduce PHPCS tests * Update plugin based on PHPCS results diff --git a/bin/deploy.sh b/bin/deploy.sh new file mode 100755 index 0000000000000000000000000000000000000000..6017029f2e954363efa050b9dbc3ca699e9fec26 --- /dev/null +++ b/bin/deploy.sh @@ -0,0 +1,130 @@ +#!/usr/bin/env bash + +## MIT License +## +## Copyright (c) 2019 Helen Hou-Sandi +## Copyright (c) 2019 Erick Hitter +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to deal +## in the Software without restriction, including without limitation the rights +## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +## copies of the Software, and to permit persons to whom the Software is +## furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be included in all +## copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +## SOFTWARE. + +# Note that this does not use pipefail +# because if the grep later doesn't match any deleted files, +# which is likely the majority case, +# it does not exit with a 0, and I only care about the final exit. +set -eo + +# Ensure SVN username and password are set +# IMPORTANT: while secrets are encrypted and not viewable in the GitHub UI, +# they are by necessity provided as plaintext in the context of the Action, +# so do not echo or use debug mode unless you want your secrets exposed! +if [[ -z "$CI" ]]; then + echo "Script is only to be run by GitLab CI" 1>&2 + exit 1 +fi + +if [[ -z "$WP_ORG_USERNAME" ]]; then + echo "WordPress.org username not set" 1>&2 + exit 1 +fi + +if [[ -z "$WP_ORG_PASSWORD" ]]; then + echo "WordPress.org password not set" 1>&2 + exit 1 +fi + +if [[ -z "$PLUGIN_SLUG" ]]; then + echo "Plugin's SVN slug is not set" 1>&2 + exit 1 +fi + +if [[ -z "$PLUGIN_VERSION" ]]; then + echo "Plugin's version is not set" 1>&2 + exit 1 +fi + +echo "ℹ︎ PLUGIN_SLUG is $PLUGIN_SLUG" +echo "ℹ︎ PLUGIN_VERSION is $PLUGIN_VERSION" + +SVN_URL="https://plugins.svn.wordpress.org/${PLUGIN_SLUG}/" +SVN_DIR="$CI_BUILDS_DIR/svn-${PLUGIN_SLUG}" +TMP_DIR="$CI_BUILDS_DIR/git-archive" + +# Checkout just trunk for efficiency +# Tagging will be handled on the SVN level +echo "➤ Checking out .org repository..." +svn checkout --depth immediates "$SVN_URL" "$SVN_DIR" +cd "$SVN_DIR" +svn update --set-depth infinity trunk + +# Ensure we are in the $CI_PROJECT_DIR directory, just in case +echo "➤ Copying files..." +cd "$CI_PROJECT_DIR" + +git config --global user.email "git-contrib+ci@ethitter.com" +git config --global user.name "Erick Hitter (GitLab CI)" + +# If there's no .gitattributes file, write a default one into place +if [[ ! -e "$CI_PROJECT_DIR/.gitattributes" ]]; then + cat > "$CI_PROJECT_DIR/.gitattributes" <<-EOL + /.gitattributes export-ignore + /.gitignore export-ignore + /.github export-ignore + EOL + + # The .gitattributes file has to be committed to be used + # Just don't push it to the origin repo :) + git add .gitattributes && git commit -m "Add .gitattributes file" +fi + +# This will exclude everything in the .gitattributes file with the export-ignore flag +mkdir "$TMP_DIR" +git archive HEAD | tar x --directory="$TMP_DIR" + +cd "$SVN_DIR" + +# Copy from clean copy to /trunk +# The --delete flag will delete anything in destination that no longer exists in source +rsync -r "$TMP_DIR/" trunk/ --delete + +# Add everything and commit to SVN +# The force flag ensures we recurse into subdirectories even if they are already added +# Suppress stdout in favor of svn status later for readability +echo "➤ Preparing files..." +svn add . --force > /dev/null + +# SVN delete all deleted files +# Also suppress stdout here +svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm % > /dev/null + +# Copy tag locally to make this a single commit +echo "➤ Copying tag..." +svn cp "trunk" "tags/$PLUGIN_VERSION" + +svn status + +# Stop here unless this is a merge into master. +if [[ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" || "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "master" ]]; then + echo "𝘅︎ EXITING before commit step as this is the '${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}' branch, not the 'master' branch." 1>&2 + exit 0 +fi + +echo "➤ Committing files..." +svn commit -m "Update to version ${PLUGIN_VERSION} from GitLab (${CI_PROJECT_URL}; ${CI_JOB_URL})" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" + +echo "✓ Plugin deployed!" diff --git a/readme.txt b/readme.txt index f11555ab783ecd9be3037855330f2642124951ff..704706cf39bc1b95aacf52b061a90e81bf2af9e2 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: http://www.thinkoomph.com/plugins-modules/view-all-posts-pages/ Tags: view all, pages, paged, paged post, multipage, single view, single page, wp_link_pages, nextpage, next page, quicktag Requires at least: 3.2.1 Tested up to: 5.1 -Stable tag: 0.9.1 +Stable tag: 0.9.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -52,6 +52,7 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an == Changelog == = 0.9.2 = +* Compatible with PHP 7.3 * Introduce PHPCS tests * Update plugin based on PHPCS results