From 0a88d0c1a689cadd95864bfdfb1555855bd5db92 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sat, 13 Apr 2019 18:28:20 -0700 Subject: [PATCH] Add (deprecated) loader script --- README.md | 9 +++++++++ scripts/loader.sh | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 scripts/loader.sh diff --git a/README.md b/README.md index afb1d26..23e626d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ Deploy plugin updates to WordPress.org's plugin SVN. Modeled on [10up's GitHub a ## Configuration +1. Add the `.gitlab-ci.yml` configuration described below. +1. Set the environment variables in the GitLab project. + ### `.gitlab-ci.yml` Add the following to the plugin's `.gitlab-ci.yml`: @@ -15,6 +18,8 @@ PluginSVN: before_script: - apt-get update - apt-get install -y rsync + - curl -o ./bin/deploy.sh https://git-cdn.e15r.co/open-source/wp-org-plugin-deploy/raw/master/scripts/deploy.sh + - chmod +x ./bin/deploy.sh script: ./bin/deploy.sh when: on_success ``` @@ -37,3 +42,7 @@ Set the following environment variables in the GitLab project's configuration: * `PLUGIN_SLUG` - plugin's name on WordPress.org * `PLUGIN_VERSION` - version to tag * `WP_ORG_RELEASE_REF` - commit ref (branch or tag) to use for release + +### Alternatives + +A [loader script](./scripts/loader.sh) is available as an alternative to downloading the deploy script during the `before_script` stage. diff --git a/scripts/loader.sh b/scripts/loader.sh new file mode 100755 index 0000000..5a358c9 --- /dev/null +++ b/scripts/loader.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# 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 + +# Download shared script and execute. +# See https://git.ethitter.com/open-source/wp-org-plugin-deploy/blob/master/README.md +DEPLOY_SCRIPT_SRC="https://git-cdn.e15r.co/open-source/wp-org-plugin-deploy/raw/master/scripts/deploy.sh" +DEPLOY_SCRIPT_NAME="deploy-wp-org.sh" + +echo "ℹ︎ Downloading script from $DEPLOY_SCRIPT_SRC" + +curl -o "./${DEPLOY_SCRIPT_NAME}" "$DEPLOY_SCRIPT_SRC" +chmod +x "./${DEPLOY_SCRIPT_NAME}" + +echo "ℹ︎ Running $DEPLOY_SCRIPT_NAME" +bash "./${DEPLOY_SCRIPT_NAME}" -- GitLab