Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
org
  • Loading branch information
Kristian Freeman committed Oct 11, 2019
1 parent c3eb4af commit aab7849
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions entrypoint.sh
Expand Up @@ -6,30 +6,6 @@ export HOME="/github/workspace"
export NVM_DIR="/github/workspace/nvm"
export WRANGLER_HOME="/github/workspace"

function install_nvm() {
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
}

function main() {
mkdir -p "$HOME/.wrangler"
chmod -R 777 "$HOME/.wrangler"

install_nvm

sanitize "${INPUT_EMAIL}" "email"
export CLOUDFLARE_EMAIL="$INPUT_EMAIL"
sanitize "${INPUT_APIKEY}" "apiKey"
export CLOUDFLARE_API_KEY="$INPUT_APIKEY"

npm i @cloudflare/wrangler -g
npm i

wrangler whoami
wrangler publish
}

# h/t https://github.com/elgohr/Publish-Docker-Github-Action
function sanitize() {
if [ -z "${1}" ]; then
Expand All @@ -38,4 +14,21 @@ function sanitize() {
fi
}

main
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

mkdir -p "$HOME/.wrangler"
chmod -R 777 "$HOME/.wrangler"

_sanitize "${INPUT_EMAIL}" "email"
export CLOUDFLARE_EMAIL="$INPUT_EMAIL"
_sanitize "${INPUT_APIKEY}" "apiKey"
export CLOUDFLARE_API_KEY="$INPUT_APIKEY"

npm i @cloudflare/wrangler -g
npm i

wrangler whoami
wrangler publish

0 comments on commit aab7849

Please sign in to comment.