generated from wabarc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
47 lines (35 loc) · 1.48 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
set -e
# Respect NPM_CONFIG_USERCONFIG if it is provided, default to $HOME/.npmrc
NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG-"$HOME/.npmrc"}"
if [ -n "$NPM_CUSTOM_NPMRC" ]; then
# Use a fully-formed npmrc file if provided
echo "$NPM_CUSTOM_NPMRC" > "$NPM_CONFIG_USERCONFIG"
chmod 0600 "$NPM_CONFIG_USERCONFIG"
elif [ -n "$NPM_AUTH_TOKEN" ]; then
# Respect NPM_CONFIG_USERCONFIG if it is provided, default to $HOME/.npmrc
NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG-"$HOME/.npmrc"}"
NPM_REGISTRY_URL="${NPM_REGISTRY_URL-registry.npmjs.org}"
NPM_STRICT_SSL="${NPM_STRICT_SSL-true}"
NPM_REGISTRY_SCHEME="https"
if ! $NPM_STRICT_SSL; then
NPM_REGISTRY_SCHEME="http"
fi
# Allow registry.npmjs.org to be overridden with an environment variable
printf "//%s/:_authToken=%s\\nregistry=%s\\nstrict-ssl=%s" "$NPM_REGISTRY_URL" "$NPM_AUTH_TOKEN" "${NPM_REGISTRY_SCHEME}://$NPM_REGISTRY_URL" "${NPM_STRICT_SSL}" > "$NPM_CONFIG_USERCONFIG"
chmod 0600 "$NPM_CONFIG_USERCONFIG"
fi
export NODE_OPTIONS="--max-old-space-size=4096"
if [ -z "$DISTRIBUTE_OWNER" ]; then
DISTRIBUTE_OWNER="$GITHUB_REPOSITORY_OWNER"
fi
if [ -z "$DISTRIBUTE_REPO" ]; then
DISTRIBUTE_REPO="${GITHUB_REPOSITORY#*/}"
fi
if [ -z "$DISTRIBUTE_CMD" ]; then
DISTRIBUTE_CMD="github"
fi
if [ -z "$DISTRIBUTE_LIMIT" ]; then
DISTRIBUTE_LIMIT=20
fi
broker "$DISTRIBUTE_CMD" -t "$DISTRIBUTE_TOKEN" -o "$DISTRIBUTE_OWNER" -r "$DISTRIBUTE_REPO" -c "$DISTRIBUTE_CHANNEL" -l "$DISTRIBUTE_LIMIT"