1 | #!/bin/bash
|
2 | set -e
|
3 |
|
4 |
|
5 |
|
6 | neutral_exit() {
|
7 | EXIT_CODE=$?
|
8 | [[ $EXIT_CODE == "78" ]] && exit 0 || exit $EXIT_CODE
|
9 | }
|
10 | trap neutral_exit EXIT
|
11 |
|
12 |
|
13 |
|
14 | if [ -n "$NPM_AUTH_TOKEN" ]; then
|
15 |
|
16 | NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG-"$HOME/.npmrc"}"
|
17 | NPM_REGISTRY_URL="${NPM_REGISTRY_URL-registry.npmjs.org}"
|
18 |
|
19 |
|
20 | printf "//%s/:_authToken=%s\\nregistry=%s" "$NPM_REGISTRY_URL" "$NPM_AUTH_TOKEN" "$NPM_REGISTRY_URL" > "$NPM_CONFIG_USERCONFIG"
|
21 | chmod 0600 "$NPM_CONFIG_USERCONFIG"
|
22 | fi
|
23 |
|
24 |
|
25 | git config --global user.email "${GIT_USER_EMAIL:-$(jq -r .pusher.email $GITHUB_EVENT_PATH)}"
|
26 | git config --global user.name "${GIT_USER_NAME:-$(jq -r .pusher.name $GITHUB_EVENT_PATH)}"
|
27 |
|
28 | git config --list
|
29 |
|
30 | sh -c "/primer-publish/cli.js $*"
|