samvera/serverless-iiif

View on GitHub
bin/update_version

Summary

Maintainability
Test Coverage
#!/usr/bin/env bash

root=$(dirname $0)/..
version=$1
if [[ -z $version ]]; then
  echo "Usage: $(basename $0) NEW_VERSION"
  exit 1
fi

for f in $root/package.json $root/src/package.json $root/dependencies/package.json; do
  content=$(cat $f)
  jq --arg v "$version" '.version = $v' <<< $content > $f
done

if [[ "$OSTYPE" = "darwin*" ]]; then
  sedreplace="sed -Ei ''"
else
  sedreplace="sed -Ei"
fi

for template in sam/template.yml sam/standalone/template.yml sam/cloudfront/template.yml examples/sam/customization/template.yaml examples/cloudformation/custom_hostname.yml; do
  $sedreplace "s/SemanticVersion: .+/SemanticVersion: $version/" $root/$template
done
$sedreplace "s/  serverless_iiif_app_version   =.+/  serverless_iiif_app_version   = \"$version\"/" $root/extras/terraform/main.tf