From fd79d3b5c87aa3e6ce8e5f5104aafa89e07a42de Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sat, 9 Jul 2022 16:07:16 -0700 Subject: [PATCH] Allow deploy to be skipped without failing the job --- README.md | 1 + scripts/deploy.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 08c6f29..27f5aac 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Set the following environment variables in the GitLab project's configuration: * `PLUGIN_VERSION` - version to tag * `WP_ORG_RELEASE_REF` - git commit ref (branch or tag) to use for release * `WP_ORG_ASSETS_DIR` - directory name, relative to repo root, where screenshots and other static assets are held +* `WP_ORG_DEPLOY_SKIP` - set to `1` to skip the deploy without failing the job ### Alternate loading method diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 477ed86..aec400d 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -16,13 +16,19 @@ function cleanup() { # Provide a basic version identifier, particularly since this script # is usually accessed via CDN. -echo "ℹ︎ WP-ORG-PLUGIN-DEPLOY VERSION: 2019051201" +echo "ℹ︎ WP-ORG-PLUGIN-DEPLOY VERSION: 2022070901" if [[ -z "$CI" ]]; then echo "𝘅︎ Script is only to be run by GitLab CI" 1>&2 exit 1 fi +# Allow deploy to be skipped if desired. +if [[ "1" == "$WP_ORG_DEPLOY_SKIP" ]]; then + echo "ℹ︎ WordPress.org deploy skipped due to WP_ORG_DEPLOY_SKIP variable" 1>&2 + exit 0 +fi + # Ensure certain environment variables are set # IMPORTANT: while access to secrets is restricted in the GitLab UI, # they are by necessity provided as plaintext in the context of this script, -- GitLab