From c09ecc83b5680783533e256be57db2c302236414 Mon Sep 17 00:00:00 2001 From: Kristian Freeman Date: Mon, 14 Oct 2019 15:24:54 -0500 Subject: [PATCH] Add environment support, change input names --- action.yml | 6 ++++-- entrypoint.sh | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index 410900b..bdacd7e 100644 --- a/action.yml +++ b/action.yml @@ -4,9 +4,11 @@ runs: using: 'docker' image: 'Dockerfile' inputs: - CLOUDFLARE_API_KEY: + apiKey: description: "Your Cloudflare API Key" required: true - CLOUDFLARE_EMAIL: + email: description: "Your Cloudflare Email" required: true + environment: + description: "The environment you'd like to publish your Workers project to - must be defined in wrangler.toml" diff --git a/entrypoint.sh b/entrypoint.sh index 800702d..c243517 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,15 +22,21 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash mkdir -p "$HOME/.wrangler" chmod -R 777 "$HOME/.wrangler" -sanitize "${INPUT_CLOUDFLARE_EMAIL}" "CLOUDFLARE_EMAIL" -sanitize "${INPUT_CLOUDFLARE_API_KEY}" "CLOUDFLARE_API_KEY" +sanitize "${INPUT_CLOUDFLAREEMAIL}" "CLOUDFLARE_EMAIL" +sanitize "${INPUT_CLOUDFLAREAPI_KEY}" "CLOUDFLARE_API_KEY" -export CF_EMAIL="$INPUT_CLOUDFLARE_EMAIL" -export CF_API_KEY="$INPUT_CLOUDFLARE_API_KEY" +export CF_EMAIL="$INPUT_CLOUDFLAREEMAIL" +export CF_API_KEY="$INPUT_CLOUDFLAREAPIKEY" npm i @cloudflare/wrangler -g npm i -wrangler whoami -wrangler publish +ls + +if [ -z "$INPUT_ENVIRONMENT" ] +then + wrangler publish -e "$INPUT_ENVIRONMENT" +else + wrangler publish +fi