#!/usr/bin/env bash

set -exu

echo mock release

CURRENT_PUBLISHED_VERSION="$(npm show . version)"
CURRENT_SPECIFIED_VERSION="$(node -p "require('./package.json').version")"

if [ "$CURRENT_PUBLISHED_VERSION" = "$CURRENT_SPECIFIED_VERSION" ]; then
    echo "Version $CURRENT_PUBLISHED_VERSION" has already been released, skipping!
else
    echo "Running release for version $CURRENT_SPECIFIED_VERSION"
    npm ci
    npm run build
    # npx envsub './bin/npmrc-public' .npmrc
    npm publish
fi

