#!/usr/bin/env bash
set -euo pipefail

if [[ -z "$( git config user.signingkey )" ]]; then
  echo "$0: GPG signing key required." >&2
  exit 2
fi

repo_dir="$( cd $( dirname $0 )/.. && pwd )"
deploy_dir="$( git config deploy.dir )"

cd "$deploy_dir"
deploy_commit_date="$( git show -s --format=%ci | awk '{print $1;}' )"
deploy_commit_id="$( git rev-parse --short HEAD )"
tag="deploy/$deploy_commit_date/$deploy_commit_id"

cd "$repo_dir"
git tag -s "$tag" -m "deployed" && git push --tags

Add git tagging script to track deployments
Add git tagging script to track deployments

To be run after a deployment.  Gets the most recent deployment info from
the configured deploy repo (via the deploy.dir git config setting),
applies a GPG-signed tag to the most recent commit, and pushes the new
tag to the default remote.

Change-Id: Ibac1d8c1b343b5fb5fd26a954541491e76cc835f
