Untitled
unknown
plain_text
14 days ago
1.1 kB
2
Indexable
Never
- if ! [[ -f ".npmrc" ]] ; then - if [[ $REPO == "" || $REPO_TOKEN == "" ]]; then - echo "NPM Project Repo name or Auth token not provided." - exit 1 - fi - echo "Unable to find .npmrc, Creating one" - echo "registry = $NPM_REGISTRY_BASE_URL/$REPO/" >> .npmrc - echo "email=$GITLAB_USER_EMAIL" >> .npmrc - echo "$(echo $NPM_REGISTRY_BASE_URL | cut -c6-)/$REPO/:_auth=$REPO_TOKEN" >> .npmrc - npmrc_file_created="true" - else - if ! grep -q "_auth" .npmrc; then - if [[ $REPO_TOKEN == "" ]]; then - echo "NPM Project token not provided." - exit 1 - else - echo "$(echo $NPM_REGISTRY_BASE_URL | cut -c6-)/$REPO/:_auth=$REPO_TOKEN" >> .npmrc - fi - fi - if ! grep -q "registry" .npmrc; then - if [[ $REPO == "" ]]; then - echo "NPM Project Name via variable 'REPO' not provided." - exit 1 - else - echo "registry=$NPM_REGISTRY_BASE_URL/$REPO/" >> .npmrc - fi - fi - fi
Leave a Comment