Skip to content

Commit 4e7a139

Browse files
committed
[DXDP-2305] fix: add artifactory credentials
1 parent c582979 commit 4e7a139

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

postbuild.sh

+14
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,17 @@ if [ "$GIT_SSH_KEY" != "" ]; then
1818
# Clear that sensitive key data from the environment
1919
export GIT_SSH_KEY=0
2020
fi
21+
22+
# Clean up Artifactory npm setup
23+
if [ ! -z "$NPM_REGISTRY_TOKEN" ] && [ ! -z "$NPM_REGISTRY_USER" ] && [ ! -z "$NPM_REGISTRY_URL" ] && [ ! -z "$NPM_REGISTRY_AUTH" ]; then
24+
echo "Cleaning up NPM config" >&1
25+
26+
# Now that npm has finished running, we shouldn't need the registry config anymore.
27+
# Remove the files that we created.
28+
rm -f ~/.npmrc
29+
30+
# Clear that sensitive key data from the environment
31+
export NPM_REGISTRY_TOKEN=0
32+
echo "... done."
33+
echo "" >&1
34+
fi

prebuild.sh

+14
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,17 @@ shopt -u dotglob
4646

4747
commitHash=$(git rev-parse --short HEAD)
4848
echo "Docs site successfully setup. auth0-docs commit: $commitHash"
49+
50+
# Setup Artifactory npm registry and permissions
51+
if [ ! -z "$NPM_REGISTRY_TOKEN" ] && [ ! -z "$NPM_REGISTRY_USER" ] && [ ! -z "$NPM_REGISTRY_URL" ] && [ ! -z "$NPM_REGISTRY_AUTH" ]; then
52+
echo "Detected NPM Registry. Adding Artifactory config..." >&1
53+
echo "registry=$NPM_REGISTRY_URL" > ~/.npmrc
54+
curl -s -u $NPM_REGISTRY_USER:$NPM_REGISTRY_TOKEN $NPM_REGISTRY_AUTH >> ~/.npmrc
55+
success=$?
56+
if [ $success -ne 0 ]; then
57+
echo "... failed!"
58+
else
59+
echo "... done."
60+
fi
61+
echo "" >&1
62+
fi

0 commit comments

Comments
 (0)