-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathtag.sh
More file actions
executable file
·40 lines (31 loc) · 934 Bytes
/
tag.sh
File metadata and controls
executable file
·40 lines (31 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash -e
cd "$(dirname "$0")"
ROOT=$(pwd)
if [ -z "$1" ]; then
echo "Usage: ./tag.sh <PluginName>"
echo "Example: ./tag.sh ABTester"
exit 1
fi
PLUGIN="$1"
PLUGIN_DIR="$ROOT/plugins/$PLUGIN"
if [ ! -d "$PLUGIN_DIR" ]; then
echo "Error: Plugin directory not found: $PLUGIN_DIR"
exit 1
fi
if [ ! -f "$PLUGIN_DIR/VERSION" ]; then
echo "Error: VERSION file not found: $PLUGIN_DIR/VERSION"
exit 1
fi
VER=$(cat "$PLUGIN_DIR/VERSION")
# Check that the version exists in the Changelist.txt
if [ -f "$PLUGIN_DIR/Changelist.txt" ]; then
if ! grep -q "^${VER}:*$" "$PLUGIN_DIR/Changelist.txt"; then
echo "Error: Version $VER not found in $PLUGIN_DIR/Changelist.txt"
exit 1
fi
fi
# Convert plugin name to lowercase for tag
TAG_PREFIX=$(echo "$PLUGIN" | tr '[:upper:]' '[:lower:]')
TAG="${TAG_PREFIX}_v${VER}"
echo "Tagging $PLUGIN [$TAG]"
git tag "$TAG" && git push origin "$TAG"