OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
#!/bin/bash
# Tags to manage
TAGS=("self-hosting")
# Get commit from argument or default to HEAD
COMMIT="${1:-HEAD}"
echo "π·οΈ Managing tags: ${TAGS[@]}"
echo "π Target commit: $COMMIT"
echo ""
# Verify commit exists
if ! git rev-parse --verify "$COMMIT" >/dev/null 2>&1; then
echo "β Error: Invalid commit reference: $COMMIT"
exit 1
fi
# Delete local tags
echo "ποΈ Deleting local tags..."
for tag in "${TAGS[@]}"; do
if git tag -l "$tag" | grep -q "$tag"; then
git tag -d "$tag"
echo " β Deleted local tag: $tag"
else
echo " - Tag $tag doesn't exist locally"
fi
done
echo ""
# Delete remote tags
echo "ποΈ Deleting remote tags..."
for tag in "${TAGS[@]}"; do
if git ls-remote --tags origin | grep -q "refs/tags/$tag"; then
SKIP_HOOKS=1 git push origin ":refs/tags/$tag" 2>/dev/null
echo " β Deleted remote tag: $tag"
else
echo " - Tag $tag doesn't exist on remote"
fi
done
echo ""
# Create new tags
echo "π·οΈ Creating new tags on commit $COMMIT..."
for tag in "${TAGS[@]}"; do
git tag "$tag" "$COMMIT"
echo " β Created tag: $tag"
done
echo ""
# Push tags
echo "π Pushing tags to remote..."
SKIP_HOOKS=1 git push origin "${TAGS[@]}"
echo ""
echo "β
Done! Tags updated successfully."