Add environment support, change input names

This commit is contained in:
Kristian Freeman 2019-10-14 15:24:54 -05:00
parent 26e61bb08a
commit c09ecc83b5
2 changed files with 16 additions and 8 deletions

View file

@ -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"

View file

@ -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