Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

1.3 KB
Raw Blame
#!/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."