laconic-console/scripts/deploy_apps_to_wns.sh

46 lines
1.1 KiB
Bash
Raw Normal View History

2020-06-12 04:00:01 +00:00
#!/bin/bash
set -euo pipefail
for appdir in `find ./packages -name '*-app' -type d | grep -v node_modules`; do
pushd $appdir
2020-08-27 18:08:19 +00:00
WNS_ORG="dxos"
2020-06-12 04:00:01 +00:00
PKG_NAME=`cat package.json | jq -r '.name' | cut -d'/' -f2-`
PKG_DESC=`cat package.json | jq -r '.description'`
PKG_VERSION=`cat package.json | jq -r '.version'`
if [ -z "$PKG_DESC" ]; then
PKG_DESC="$PKG_NAME"
fi
2020-08-27 18:08:19 +00:00
WNS_NAME="$WNS_ORG/$PKG_NAME"
2020-08-27 18:10:47 +00:00
WNS_VERSION=`yarn -s wire wns name resolve wrn://${WNS_ORG}/application/${PKG_NAME} | jq -r '.records[0].attributes.version'`
2020-06-12 04:00:01 +00:00
if [ -z "$WNS_VERSION" ]; then
2020-08-27 18:08:19 +00:00
WNS_VERSION="0.0.1"
2020-06-12 04:00:01 +00:00
fi
cat <<EOF > app.yml
2020-08-27 18:08:19 +00:00
name: $PKG_NAME
2020-06-12 04:00:01 +00:00
build: yarn dist
version: $WNS_VERSION
EOF
2020-06-13 04:30:50 +00:00
yarn clean
# TODO(telackey): We need to fix `wire app build` not to bake in a path!
# In the meantime, use `yarn dist` which will not.
# yarn -s wire app build
yarn dist
2020-06-12 04:00:01 +00:00
if [ -d "dist/production" ]; then
yarn -s wire app publish --path './dist/production'
else
yarn -s wire app publish
fi
2020-08-27 18:08:19 +00:00
yarn -s wire app register --name "wrn://${WNS_ORG}/application/${PKG_NAME}"
2020-06-12 04:00:01 +00:00
popd
done