-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·45 lines (37 loc) · 1 KB
/
entrypoint.sh
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
41
42
43
44
45
#!/bin/bash
TAG=$1
if [[ -z "$SVN_USERNAME" ]]; then
echo "Set the SVN_USERNAME secret"
exit 1
fi
if [[ -z "$SVN_PASSWORD" ]]; then
echo "Set the SVN_PASSWORD secret"
exit 1
fi
if [[ -z "$SLUG" ]]; then
SLUG=${GITHUB_REPOSITORY#*/}
fi
echo "ℹ︎ SLUG is $SLUG"
SVN_URL="https://plugins.svn.wordpress.org/${SLUG}/"
SVN_DIR="/github/svn-${SLUG}"
echo "➤ Checking out .org repository..."
svn checkout --depth immediates "$SVN_URL" "$SVN_DIR" --trust-server-cert
if [ $? -ne 0 ]; then
echo "ℹ︎ Error on SVN checkout, exiting"
exit 1
fi
cd "$SVN_DIR"
svn update --set-depth infinity tags --trust-server-cert
echo "➤ Removing tag $TAG"
cd "${SVN_DIR}/tags"
svn delete $TAG
if [ $? -ne 0 ]; then
echo "ℹ︎ Cannot remove the tag. Are you sure it exists?"
exit 1
fi
svn commit -m "Removed tag" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --trust-server-cert
if [ $? -ne 0 ]; then
echo "ℹ︎ Cannot remove the tag."
exit 1
fi
echo "✓ Tag removed!"