Skip to content
Snippets Groups Projects
Commit 7209c68f authored by Tom Robinson's avatar Tom Robinson
Browse files

Remove deploy-metabase-deploy script (replaced with script in metabase-deploy repo

parent ef423ff6
Branches
Tags
No related merge requests found
#!/usr/bin/env bash
set -eu
set -o pipefail
SRC_DIR="$PWD"
DEPLOY_DIR="$PWD/.metabase_deploy"
if [ "$#" -lt 2 ]; then
echo "USAGE: deploy-metabase-deploy metabase.jar VERSION_TAG [GIT REMOTE]"
exit 1
fi
METABASE_JAR="$1"
DEPLOY_TAG="$2"
if [ "$#" -gt 2 ]; then
DEPLOY_REPO="$3"
else
DEPLOY_REPO="git@github.com:metabase/metabase-deploy.git"
fi
DEPLOY_REPO_SLUG="$(echo "$DEPLOY_REPO" | grep -Eo "[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+")"
DEPLOY_TREE="$DEPLOY_REPO_SLUG/tree/$DEPLOY_TAG"
# clone the metabase-deploy repo
git clone "$DEPLOY_REPO" "$DEPLOY_DIR"
# copy the jar
mkdir -p "$DEPLOY_DIR/target/uberjar"
cp "$METABASE_JAR" "$DEPLOY_DIR/target/uberjar/metabase-standalone.jar"
# copy the other required files
FILES="Procfile app.json bin/start"
for FILE in $FILES; do
mkdir -p "$DEPLOY_DIR/$(dirname $FILE)"
cp "$FILE" "$DEPLOY_DIR/$FILE"
done
# change to the deploy directory
cd "$DEPLOY_DIR"
# modify app.json to use null-buildpack since we're using a pre-compiled jar
node <<EOF
var fs = require("fs");
var app = JSON.parse(fs.readFileSync("app.json"));
app.buildpacks = [{ "url": "http://github.com/ryandotsmith/null-buildpack.git" }];
delete app.env.NPM_CONFIG_LOGLEVEL;
fs.writeFileSync("app.json", JSON.stringify(app, null, 2));
EOF
# generate a README
cat > README.md <<EOF
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/$DEPLOY_TREE)
EOF
# add, commit, tag, and push
git add .
git commit -m "Deploy $DEPLOY_TAG"
git tag "$DEPLOY_TAG"
git push --tags "$DEPLOY_REPO" master
# change back
cd "$SRC_DIR"
# pretend like this never happened
rm -rf "$DEPLOY_DIR"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment