diff --git a/jfrog-oauth/run.sh b/jfrog-oauth/run.sh index f550474..fe4b9b4 100644 --- a/jfrog-oauth/run.sh +++ b/jfrog-oauth/run.sh @@ -33,9 +33,9 @@ email=${ARTIFACTORY_EMAIL} registry=${JFROG_URL}/artifactory/api/npm/${REPOSITORY_NPM} EOF if [ "$(npm --version | cut -d. -f1)" -ge 9 ]; then - echo "//${JFROG_HOST}/artifactory/api/npm/${REPOSITORY_NPM}/:_authToken=${ARTIFACTORY_ACCESS_TOKEN}" >> ~/.npmrc + echo "//${JFROG_HOST}/artifactory/api/npm/${REPOSITORY_NPM}/:_authToken=$(jf rt curl /api/npm/auth | awk -F'= ' '/_auth =/{print $2}')" >> ~/.npmrc else - echo "_auth=${ARTIFACTORY_ACCESS_TOKEN}" >> ~/.npmrc + echo "_auth=$(jf rt curl /api/npm/auth | awk -F'= ' '/_auth =/{print $2}')" >> ~/.npmrc echo "always-auth=true" >> ~/.npmrc fi fi diff --git a/jfrog-token/run.sh b/jfrog-token/run.sh index f550474..fe4b9b4 100644 --- a/jfrog-token/run.sh +++ b/jfrog-token/run.sh @@ -33,9 +33,9 @@ email=${ARTIFACTORY_EMAIL} registry=${JFROG_URL}/artifactory/api/npm/${REPOSITORY_NPM} EOF if [ "$(npm --version | cut -d. -f1)" -ge 9 ]; then - echo "//${JFROG_HOST}/artifactory/api/npm/${REPOSITORY_NPM}/:_authToken=${ARTIFACTORY_ACCESS_TOKEN}" >> ~/.npmrc + echo "//${JFROG_HOST}/artifactory/api/npm/${REPOSITORY_NPM}/:_authToken=$(jf rt curl /api/npm/auth | awk -F'= ' '/_auth =/{print $2}')" >> ~/.npmrc else - echo "_auth=${ARTIFACTORY_ACCESS_TOKEN}" >> ~/.npmrc + echo "_auth=$(jf rt curl /api/npm/auth | awk -F'= ' '/_auth =/{print $2}')" >> ~/.npmrc echo "always-auth=true" >> ~/.npmrc fi fi