diff --git a/standards/mcp/templates/drone/npm-lib.yaml b/standards/mcp/templates/drone/npm-lib.yaml index 9513b61..2ab3a5b 100644 --- a/standards/mcp/templates/drone/npm-lib.yaml +++ b/standards/mcp/templates/drone/npm-lib.yaml @@ -22,18 +22,17 @@ steps: from_secret: NPM_PASSWORD commands: - apk add --no-cache curl - - PACKAGE_NAME=$(node -p "require('./package.json').name") - - VERSION=$(node -p "require('./package.json').version") - | + PACKAGE_NAME=$(node -p "require('./package.json').name") + VERSION=$(node -p "require('./package.json').version") if [ "$DRONE_TAG" != "$VERSION" ]; then echo "Tag '$DRONE_TAG' does not match package.json version '$VERSION'; refusing to publish." exit 1 fi - - NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') - - echo "registry=$NPM_REPO_URL" > /tmp/.npmrc - - echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> /tmp/.npmrc - - echo "Checking if $PACKAGE_NAME@$VERSION exists on $NPM_REPO_URL ..." - - | + NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') + echo "registry=$NPM_REPO_URL" > /tmp/.npmrc + echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> /tmp/.npmrc + echo "Checking if $PACKAGE_NAME@$VERSION exists on $NPM_REPO_URL ..." if npm view "$PACKAGE_NAME@$VERSION" version --userconfig /tmp/.npmrc >/dev/null 2>&1; then echo "$PACKAGE_NAME@$VERSION already exists; skipping build." exit 78 @@ -56,9 +55,9 @@ steps: echo "NPM_REPO_URL / NPM_USERNAME / NPM_PASSWORD are not set" >&2 exit 1 fi - - NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') - - echo "registry=$NPM_REPO_URL" > .npmrc - - echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc + NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') + echo "registry=$NPM_REPO_URL" > .npmrc + echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc - npm install - echo "Running quality gate..." - npm run quality-gate @@ -81,9 +80,10 @@ steps: NPM_PASSWORD: from_secret: NPM_PASSWORD commands: - - NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') - - echo "registry=$NPM_REPO_URL" > .npmrc - - echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc + - | + NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') + echo "registry=$NPM_REPO_URL" > .npmrc + echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc - echo "Publishing to private npm at $NPM_REPO_URL ..." - npm publish --access restricted @@ -120,9 +120,10 @@ steps: from_secret: NPM_PASSWORD commands: - apk add --no-cache git - - NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') - - echo "registry=$NPM_REPO_URL" > /tmp/.npmrc - - echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> /tmp/.npmrc + - | + NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') + echo "registry=$NPM_REPO_URL" > /tmp/.npmrc + echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> /tmp/.npmrc - | set -e diff --git a/standards/src/templates/drone/npm-lib.yaml b/standards/src/templates/drone/npm-lib.yaml index 9513b61..2ab3a5b 100644 --- a/standards/src/templates/drone/npm-lib.yaml +++ b/standards/src/templates/drone/npm-lib.yaml @@ -22,18 +22,17 @@ steps: from_secret: NPM_PASSWORD commands: - apk add --no-cache curl - - PACKAGE_NAME=$(node -p "require('./package.json').name") - - VERSION=$(node -p "require('./package.json').version") - | + PACKAGE_NAME=$(node -p "require('./package.json').name") + VERSION=$(node -p "require('./package.json').version") if [ "$DRONE_TAG" != "$VERSION" ]; then echo "Tag '$DRONE_TAG' does not match package.json version '$VERSION'; refusing to publish." exit 1 fi - - NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') - - echo "registry=$NPM_REPO_URL" > /tmp/.npmrc - - echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> /tmp/.npmrc - - echo "Checking if $PACKAGE_NAME@$VERSION exists on $NPM_REPO_URL ..." - - | + NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') + echo "registry=$NPM_REPO_URL" > /tmp/.npmrc + echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> /tmp/.npmrc + echo "Checking if $PACKAGE_NAME@$VERSION exists on $NPM_REPO_URL ..." if npm view "$PACKAGE_NAME@$VERSION" version --userconfig /tmp/.npmrc >/dev/null 2>&1; then echo "$PACKAGE_NAME@$VERSION already exists; skipping build." exit 78 @@ -56,9 +55,9 @@ steps: echo "NPM_REPO_URL / NPM_USERNAME / NPM_PASSWORD are not set" >&2 exit 1 fi - - NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') - - echo "registry=$NPM_REPO_URL" > .npmrc - - echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc + NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') + echo "registry=$NPM_REPO_URL" > .npmrc + echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc - npm install - echo "Running quality gate..." - npm run quality-gate @@ -81,9 +80,10 @@ steps: NPM_PASSWORD: from_secret: NPM_PASSWORD commands: - - NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') - - echo "registry=$NPM_REPO_URL" > .npmrc - - echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc + - | + NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') + echo "registry=$NPM_REPO_URL" > .npmrc + echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc - echo "Publishing to private npm at $NPM_REPO_URL ..." - npm publish --access restricted @@ -120,9 +120,10 @@ steps: from_secret: NPM_PASSWORD commands: - apk add --no-cache git - - NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') - - echo "registry=$NPM_REPO_URL" > /tmp/.npmrc - - echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> /tmp/.npmrc + - | + NPM_HOST=$(echo "$NPM_REPO_URL" | sed -E 's|^[a-z]+://||; s|/*$||') + echo "registry=$NPM_REPO_URL" > /tmp/.npmrc + echo "//$NPM_HOST/:_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> /tmp/.npmrc - | set -e