You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
738 B
Bash

#!/bin/bash
readonly REPO="{{ repo }}";
readonly DEST="{{ dest }}";
readonly DEST_USER="{{ owner }}";
readonly DEST_GROUP="{{ group }}";
readonly PREFIX="{{ tag_prefix }}";
readonly GPG_FINGERPRINT="{{ gpg_fingerprint }}";
set -e;
cd "$DEST";
if [ ! -d .git ]; then
git clone "$REPO" "$DEST";
fi
gpg --quiet --keyserver eu.pool.sks-keyservers.net --recv "$GPG_FINGERPRINT";
git fetch --tags > /dev/null;
TAG=$(git tag --list | grep "^$PREFIX" | sort -r | head -n 1);
if git verify-tag --raw "$TAG" 2>&1 | grep " VALIDSIG $GPG_FINGERPRINT " > /dev/null; then
git checkout -q "$TAG";
chown -R "$DEST_USER:$DEST_GROUP" .;
{{ reload_command | default('') }}
else
echo "Invalid or missing signature for $TAG" >&2;
exit 1;
fi