From 6701978876c4c081f1559ea118f345fb6526de9c Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Thu, 6 Oct 2016 15:55:00 -0400 Subject: [PATCH 1/2] Add release script and readme --- bin/readme.txt | 17 +++++++++++++ bin/release.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 bin/readme.txt create mode 100644 bin/release.sh diff --git a/bin/readme.txt b/bin/readme.txt new file mode 100644 index 0000000..17d60c8 --- /dev/null +++ b/bin/readme.txt @@ -0,0 +1,17 @@ +=== WordPress REST API - Authentication Broker === +Contributors: rmccue, rachelbaker, danielbachhuber, joehoyle +Tags: json, rest, api, rest-api, oauth, oauth1, broker +Requires at least: 4.4 +Tested up to: 4.7-alpha +Stable tag: {{TAG}} +License: GPLv2 or later +License URI: http://www.gnu.org/licenses/gpl-2.0.html + +== Description == +Used together with the [WP REST API OAuth 1.0a Server plugin](https://github.com/WP-API/OAuth1), this allows [the WP RET API Authentication Broker](https://apps.wp-api.org/) +to connect to your site. + +Read about how it works [on the reference broker](https://apps.wp-api.org/), or [read the full specification](https://apps.wp-api.org/spec/). + +== Installation == +Install this plugin onto your site to opt-in to the Broker Authentication system. This plugin requires [the OAuth Server plugin](https://github.com/WP-API/OAuth1). diff --git a/bin/release.sh b/bin/release.sh new file mode 100644 index 0000000..5483aae --- /dev/null +++ b/bin/release.sh @@ -0,0 +1,66 @@ +# release.sh +# +# Takes a tag to release, and syncs it to WordPress.org + +TAG=$1 + +PLUGIN="rest-api-broker" +TMPDIR=/tmp/rest-api-broker-release-svn +PLUGINDIR="$PWD" +PLUGINSVN="https://plugins.svn.wordpress.org/$PLUGIN" + +# Fail on any error +set -e + +# Is the tag valid? +if [ -z "$TAG" ] || ! git rev-parse "$TAG" > /dev/null; then + echo "Invalid tag. Make sure you tag before trying to release." + exit 1 +fi + +if [[ $VERSION == "v*" ]]; then + # Starts with an extra "v", strip for the version + VERSION=${TAG:1} +else + VERSION="$TAG" +fi + +if [ -d "$TMPDIR" ]; then + # Wipe it clean + rm -r "$TMPDIR" +fi + +# Ensure the directory exists first +mkdir "$TMPDIR" + +# Grab an unadulterated copy of SVN +svn co "$PLUGINSVN/trunk" "$TMPDIR" > /dev/null + +# Extract files from the Git tag to there +git archive --format="zip" -0 "$TAG" | tar -C "$TMPDIR" -xf - + +# Switch to build dir +cd "$TMPDIR" + +# Run build tasks +sed -e "s/{{TAG}}/$VERSION/g" < "$PLUGINDIR/bin/readme.txt" > readme.txt + +# Remove special files +rm ".gitignore" +rm "composer.json" +rm "book.json" +rm -r "bin" +rm -r "docs" + +# Add any new files +svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add + +# Pause to allow checking +echo "About to commit $VERSION. Double-check $TMPDIR to make sure everything looks fine." +read -p "Hit Enter to continue." + +# Commit the changes +svn commit -m "Tag $VERSION" + +# tag_ur_it +svn copy "$PLUGINSVN/trunk" "$PLUGINSVN/tags/$VERSION" -m "Tag $VERSION" From 585bb7ed1b036336c501b66528bb9a6627cf4ed6 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Thu, 6 Oct 2016 15:55:48 -0400 Subject: [PATCH 2/2] No need to remove these nonexisting files --- bin/release.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bin/release.sh b/bin/release.sh index 5483aae..a1f301f 100644 --- a/bin/release.sh +++ b/bin/release.sh @@ -46,11 +46,7 @@ cd "$TMPDIR" sed -e "s/{{TAG}}/$VERSION/g" < "$PLUGINDIR/bin/readme.txt" > readme.txt # Remove special files -rm ".gitignore" -rm "composer.json" -rm "book.json" rm -r "bin" -rm -r "docs" # Add any new files svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add