2022-08-06 20:32:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Properties: actions
|
|
|
|
# username, token, registry=https://registry.npmjs.org, scope, folder=.
|
|
|
|
# build_profile=release, make
|
|
|
|
|
|
|
|
# publish: username, token
|
|
|
|
# build:
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
cd ${PLUGIN_FOLDER:-.}
|
|
|
|
|
|
|
|
if [[ "${PLUGIN_ACTIONS}" =~ '(^|,)build(,|$)' ]]; then
|
|
|
|
if [ "${PLUGIN_SCOPE:-}" = "" ]; then
|
|
|
|
wasm-pack build --${PLUGIN_BUILD_PROFILE:-release}
|
|
|
|
else
|
|
|
|
wasm-pack build --${PLUGIN_BUILD_PROFILE:-release} --scope ${PLUGIN_SCOPE}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${PLUGIN_MAKE:-}" != ""]; then
|
|
|
|
make ${PLUGIN_MAKE}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${PLUGIN_ACTIONS}" =~ '(^|,)publish(,|$)' ]]; then
|
|
|
|
REGISTY=${PLUGIN_REGISTRY:-https://registry.npmjs.org/}
|
|
|
|
|
|
|
|
if [ "${PLUGIN_SCOPE:-}" = "" ]; then
|
|
|
|
npm config set registry ${REGISTRY}
|
|
|
|
else
|
2022-08-06 20:36:36 +00:00
|
|
|
npm config set @${PLUGIN_SCOPE}:registry ${REGISTRY}
|
2022-08-06 20:32:27 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
npm config set -- $(echo ${REGISTRY} | sed -Ee "s/^https?://"):_authToken "${PLUGIN_TOKEN}"
|
|
|
|
npm publish
|
|
|
|
fi
|