Skip to content

Commit

Permalink
Update compile
Browse files Browse the repository at this point in the history
Added support for repository user
  • Loading branch information
anandtripathi5 authored Feb 1, 2024
1 parent 1b23281 commit cad475f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bin/compile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env bash

ENV_DIR=${3:-}
build_dir=${1:-}
npmrc="$(cat $ENV_DIR/NPMRC)"
BUILD_DIR=${1:-}
GITHUB_TOKEN="$(cat $ENV_DIR/GITHUB_TOKEN)"
REPO_USER="$(cat $ENV_DIR/REPO_USER)"

if [ "$npmrc" != "" ]; then
echo "-----> Using .npmrc from config var NPMRC"
echo "$npmrc" > "$build_dir/.npmrc"

if [ "$GITHUB_TOKEN" != "" ]; then
echo "-----> Using .npmrc to install packages from https://npm.pkg.github.com/$REPO_USER"
echo "@$REPO_USER:registry=https://npm.pkg.github.com/$REPO_USER" > "$BUILD_DIR/.npmrc"
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> "$BUILD_DIR/.npmrc"
echo "//npm.pkg.github.com/$REPO_USER/:_authToken=$GITHUB_TOKEN" >> "$BUILD_DIR/.npmrc"
exit 0
fi

0 comments on commit cad475f

Please sign in to comment.