diff --git a/.distignore b/.distignore index 5de312e..92d1e9a 100644 --- a/.distignore +++ b/.distignore @@ -1,12 +1,13 @@ .distignore .editorconfig .git +.github .gitignore -.travis.yml -bin -builds composer.json composer.lock +docker-compose.yml node_modules package.json +package-lock.json phpcs.xml +vendor diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0c6045f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: Publish +concurrency: + group: ${{ github.event.repository.name }}-deploy + cancel-in-progress: true +on: + release: + types: + - published +jobs: + publish-wp-plugin: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Make language files + shell: bash + run: | + curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar + php wp-cli.phar i18n make-pot . "languages/hypothesis.pot" + - name: Publish WordPress Plugin + uses: 10up/action-wordpress-plugin-deploy@stable + env: + SVN_USERNAME: ${{ secrets.WP_SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.WP_SVN_PASSWORD }} + SLUG: hypothesis diff --git a/.gitignore b/.gitignore index 0e1602e..0917746 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ builds node_modules vendor +wp-cli* diff --git a/README.md b/README.md index bbee3e4..2b21b57 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # [hypothes.is](http://hypothes.is/) for WordPress -Stable versions are available on the -[Hypothesis plugin page on WordPress.org](https://wordpress.org/plugins/hypothesis/). +Stable versions are available on the [Hypothesis plugin page on WordPress.org](https://wordpress.org/plugins/hypothesis/). ## Install Directions @@ -14,7 +13,19 @@ Stable versions are available on the ## Publishing -New releases are automatically published to WordPress.org via Travis CI (using [this script](bin/deploy.sh)) whenever the version in [hypothesis.php](hypothesis.php) is incremented and a new version is tagged. Translation files will be updated as well. This method is largely based on the process described by [Iain Poulson](https://github.com/polevaultweb) in [this blog post](https://deliciousbrains.com/deploying-wordpress-plugins-travis/), and also makes use of the [wp-cli](https://wp-cli.org) `i18n` command. +Follow these steps to publish a new plugin version. + +1. **Update the package version** in `hypothesis.php`, `readme.txt` and `package.json`, and merge that change into the `main` branch[^1]. We use [Semantic Versioning](https://semver.org/#semantic-versioning-200). +2. **Create a tag** pointing at the version-change commit and generate a **new GitHub release** (details follow). Publishing a GitHub release will kick off a GitHub Action that will publish the plugin to wordpress.org + +### Creating a GitHub release + +Create a [new GitHub release](https://github.com/hypothesis/wp-hypothesis/releases/new/) with these values: + +1. _Tag_: Create a new tag for the release, targeting the `main` branch (your just-merged version bump should be at the tip)[^2]. The tag should match the version number, e.g. `v5.2.1`. +2. _Title_: Use the tag name. +3. Click the `Auto-generate release notes` button to generate release notes and edit as needed. We use [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) formatting.[^3] +4. Leave other fields alone/as defaults. ## License diff --git a/bin/build.sh b/bin/build.sh deleted file mode 100755 index f45365c..0000000 --- a/bin/build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -PLUGIN="hypothesis" -PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" -PLUGIN_BUILDS_PATH="$PROJECT_ROOT/builds" -VERSION=$(php -f "$PROJECT_ROOT/bin/get_plugin_version.php" "$PROJECT_ROOT" "$PLUGIN") - -cd "$PROJECT_ROOT" -[ -d "$PLUGIN_BUILDS_PATH" ] || mkdir "$PLUGIN_BUILDS_PATH" - -wp i18n make-pot . "languages/hypothesis.pot" - -mkdir "$PLUGIN_BUILDS_PATH/$PLUGIN-$VERSION" - -rsync -r --exclude-from .distignore $PROJECT_ROOT/ "$PLUGIN_BUILDS_PATH/$PLUGIN-$VERSION" diff --git a/bin/deploy.sh b/bin/deploy.sh deleted file mode 100755 index 51625e7..0000000 --- a/bin/deploy.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash - -if [[ -z "$TRAVIS" ]]; then - echo "Script is only to be run by Travis 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 "$TRAVIS_TAG" ]]; then - echo "Build tag is required" 1>&2 - exit 0 -fi - -PLUGIN="hypothesis" -PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" -PLUGIN_BUILDS_PATH="$PROJECT_ROOT/builds" -VERSION=$(php -f "$PROJECT_ROOT/bin/get_plugin_version.php" "$PROJECT_ROOT" "$PLUGIN") -BUILD_DIRECTORY="$PLUGIN_BUILDS_PATH/$PLUGIN-$VERSION" - -# Ensure the current version has been built -if [ ! -d "$BUILD_DIRECTORY" ]; then - echo "Built plugin directory $BUILD_DIRECTORY does not exist" 1>&2 - exit 1 -fi - -# Check if the tag exists for the version we are building -TAG=$(svn ls "https://plugins.svn.wordpress.org/$PLUGIN/tags/$VERSION") -error=$? -if [ $error == 0 ]; then - # Tag exists, don't deploy - echo "Tag already exists for version $VERSION, skipping deployment" - exit 1 -fi - -cd "$PLUGIN_BUILDS_PATH" - -# Clean up any previous svn dir -rm -fR svn - -# Checkout the SVN repo -svn co -q "http://$WP_ORG_USERNAME@svn.wp-plugins.org/$PLUGIN" svn - -# Move out the trunk directory to a temp location -mv svn/trunk ./svn-trunk -# Create trunk directory -mkdir svn/trunk -# Copy our new version of the plugin into trunk -rsync -r -p $BUILD_DIRECTORY/* svn/trunk - -# Copy all the .svn folders from the checked out copy of trunk to the new trunk. -# This is necessary as the Travis container runs Subversion 1.6 which has .svn dirs in every sub dir -cd svn/trunk/ -TARGET=$(pwd) -cd ../../svn-trunk/ - -# Find all .svn dirs in sub dirs -SVN_DIRS=`find . -type d -iname .svn` - -for SVN_DIR in $SVN_DIRS; do - SOURCE_DIR=${SVN_DIR/.} - TARGET_DIR=$TARGET${SOURCE_DIR/.svn} - TARGET_SVN_DIR=$TARGET${SVN_DIR/.} - if [ -d "$TARGET_DIR" ]; then - # Copy the .svn directory to trunk dir - cp -r $SVN_DIR $TARGET_SVN_DIR - fi -done - -# Back to builds dir -cd ../ - -# Remove checked out dir -rm -fR svn-trunk - -# Add new version tag -mkdir svn/tags/$VERSION -rsync -r -p $BUILD_DIRECTORY/* svn/tags/$VERSION - -# Add new files to SVN -svn stat svn | grep '^?' | awk '{print $2}' | xargs -I x svn add x@ -# Remove deleted files from SVN -svn stat svn | grep '^!' | awk '{print $2}' | xargs -I x svn rm --force x@ -svn stat svn - -# Commit to SVN -cd svn && svn commit -m "Deploy version $VERSION" --no-auth-cache --non-interactive --username "$WP_ORG_USERNAME" --password "$WP_ORG_PASSWORD" - -# Remove SVN temp dir -cd "$PLUGIN_BUILDS_PATH" && rm -fR svn diff --git a/bin/get_plugin_version.php b/bin/get_plugin_version.php deleted file mode 100644 index 1d1d3d8..0000000 --- a/bin/get_plugin_version.php +++ /dev/null @@ -1,7 +0,0 @@ - - + - - bin/ - - tests/ - - vendor/ + + tests/ + + vendor/ - - + + diff --git a/readme.txt b/readme.txt index 439a4da..d0d8065 100644 --- a/readme.txt +++ b/readme.txt @@ -1,8 +1,8 @@ -=== Plugin Name === -Contributors: timmmmyboy, BigBlueHat, JakeHartnell, greatislander +=== Hypothesis === +Contributors: timmmmyboy, BigBlueHat, JakeHartnell, greatislander, acelaya Tags: hypothesis, annotation, comments -Requires at least: 3.7 -Tested up to: 5.2.2 +Requires at least: 6.2 +Tested up to: 6.4.2 Stable tag: 0.6.0 License: BSD License URI: http://opensource.org/licenses/BSD-2-Clause