#! /usr/bin/env bash

set -euo pipefail

TRAVIS_TAG="${TRAVIS_TAG:-dev}"

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

ARCHIVE="dist-${TRAVIS_TAG}.tar.gz"

pushd "$HERE/.."
  if [ ! -d node_modules/ ]; then
    npm ci
  fi

  if [ ! -d dist/ ]; then
    npm run build
  fi

  if [ ! -d dist-ghp/ ]; then
    npm run build -- \
      --baseHref='https://blog.jonrshar.pe/salary-stats' \
      --deployUrl='/salary-stats/' \
      --outputPath=dist-ghp/
  fi

  if [ ! -f "$ARCHIVE" ]; then
    tar -zcf "$ARCHIVE" dist/
  fi
popd

#! /usr/bin/env bash

set -euo pipefail

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

ARCHIVE="dist-${TRAVIS_TAG}.tar.gz"

pushd "$HERE/.."
  if [ ! -d node_modules/ ]; then
    npm ci
  fi

  if [ ! -d dist/ ]; then
    npm run build
  fi

  if [ ! -d dist-ghp/ ]; then
    npm run build -- \
      --baseHref='https://blog.jonrshar.pe/salary-stats' \
      --outputPath=dist-ghp/
  fi

  if [ ! -f "$ARCHIVE" ]; then
    tar -zcf "$ARCHIVE" dist/
  fi
popd

--- 
+++ 
@@ -1,6 +1,8 @@
 #! /usr/bin/env bash
 
 set -euo pipefail
+
+TRAVIS_TAG="${TRAVIS_TAG:-dev}"
 
 HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 
@@ -18,6 +20,7 @@
   if [ ! -d dist-ghp/ ]; then
     npm run build -- \
       --baseHref='https://blog.jonrshar.pe/salary-stats' \
+      --deployUrl='/salary-stats/' \
       --outputPath=dist-ghp/
   fi
 
Fix asset paths for GitHub Pages deploy
