UNPKG

1.17 kBapplication/x-shView Raw
1#!/bin/bash
2set -e
3
4# Actions v1 reported a neutral status when a process exited with a 78 code.
5# Actions v2 removed support for this, so exit with a 0 code instead
6neutral_exit() {
7 EXIT_CODE=$?
8 [[ $EXIT_CODE == "78" ]] && exit 0 || exit $EXIT_CODE
9}
10trap neutral_exit EXIT
11
12# copied directly from:
13# https://github.com/actions/npm/blob/98e6dc1/entrypoint.sh#L5-L13
14if [ -n "$NPM_AUTH_TOKEN" ]; then
15 # Respect NPM_CONFIG_USERCONFIG if it is provided, default to $HOME/.npmrc
16 NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG-"$HOME/.npmrc"}"
17 NPM_REGISTRY_URL="${NPM_REGISTRY_URL-registry.npmjs.org}"
18
19 # Allow registry.npmjs.org to be overridden with an environment variable
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"
22fi
23
24# configure git with sensible defaults
25git config --global user.email "${GIT_USER_EMAIL:-$(jq -r .pusher.email $GITHUB_EVENT_PATH)}"
26git config --global user.name "${GIT_USER_NAME:-$(jq -r .pusher.name $GITHUB_EVENT_PATH)}"
27# then print out our config
28git config --list
29
30sh -c "/primer-publish/cli.js $*"