Skip to content

Commit 8d10f88

Browse files
committed
Strip v from version number
1 parent a6cd730 commit 8d10f88

1 file changed

Lines changed: 1 addition & 82 deletions

File tree

entrypoint.sh

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -29,88 +29,7 @@ echo "ℹ︎ SLUG is $SLUG"
2929
# Does it even make sense for VERSION to be editable in a workflow definition?
3030
if [[ -z "$VERSION" ]]; then
3131
VERSION=${GITHUB_REF#refs/tags/}
32+
VERSION=$(echo $VERSION | sed -e "s/v//gI")
3233
fi
3334
echo "ℹ︎ VERSION is $VERSION"
3435

35-
if [[ -z "$ASSETS_DIR" ]]; then
36-
ASSETS_DIR=".wordpress-org"
37-
fi
38-
echo "ℹ︎ ASSETS_DIR is $ASSETS_DIR"
39-
40-
SVN_URL="http://plugins.svn.wordpress.org/${SLUG}/"
41-
SVN_DIR="/github/svn-${SLUG}"
42-
43-
# Checkout just trunk and assets for efficiency
44-
# Tagging will be handled on the SVN level
45-
echo "➤ Checking out .org repository..."
46-
svn checkout --depth immediates "$SVN_URL" "$SVN_DIR"
47-
cd "$SVN_DIR"
48-
svn update --set-depth infinity assets
49-
svn update --set-depth infinity trunk
50-
51-
echo "➤ Copying files..."
52-
if [[ -e "$GITHUB_WORKSPACE/.distignore" ]]; then
53-
echo "ℹ︎ Using .distignore"
54-
# Copy from current branch to /trunk, excluding dotorg assets
55-
# The --delete flag will delete anything in destination that no longer exists in source
56-
rsync -rc --exclude-from="$GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/" trunk/ --delete
57-
else
58-
echo "ℹ︎ Using .gitattributes"
59-
60-
cd "$GITHUB_WORKSPACE"
61-
62-
# "Export" a cleaned copy to a temp directory
63-
TMP_DIR="/github/archivetmp"
64-
mkdir "$TMP_DIR"
65-
66-
git config --global user.email "10upbot+github@10up.com"
67-
git config --global user.name "10upbot on GitHub"
68-
69-
# If there's no .gitattributes file, write a default one into place
70-
if [[ ! -e "$GITHUB_WORKSPACE/.gitattributes" ]]; then
71-
cat > "$GITHUB_WORKSPACE/.gitattributes" <<-EOL
72-
/$ASSETS_DIR export-ignore
73-
/.gitattributes export-ignore
74-
/.gitignore export-ignore
75-
/.github export-ignore
76-
EOL
77-
78-
# Ensure we are in the $GITHUB_WORKSPACE directory, just in case
79-
# The .gitattributes file has to be committed to be used
80-
# Just don't push it to the origin repo :)
81-
git add .gitattributes && git commit -m "Add .gitattributes file"
82-
fi
83-
84-
# This will exclude everything in the .gitattributes file with the export-ignore flag
85-
git archive HEAD | tar x --directory="$TMP_DIR"
86-
87-
cd "$SVN_DIR"
88-
89-
# Copy from clean copy to /trunk, excluding dotorg assets
90-
# The --delete flag will delete anything in destination that no longer exists in source
91-
rsync -rc "$TMP_DIR/" trunk/ --delete
92-
fi
93-
94-
# Copy dotorg assets to /assets
95-
rsync -rc "$GITHUB_WORKSPACE/$ASSETS_DIR/" assets/ --delete
96-
97-
# Add everything and commit to SVN
98-
# The force flag ensures we recurse into subdirectories even if they are already added
99-
# Suppress stdout in favor of svn status later for readability
100-
echo "➤ Preparing files..."
101-
svn add . --force > /dev/null
102-
103-
# SVN delete all deleted files
104-
# Also suppress stdout here
105-
svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm % > /dev/null
106-
107-
# Copy tag locally to make this a single commit
108-
echo "➤ Copying tag..."
109-
svn cp "trunk" "tags/$VERSION"
110-
111-
svn status
112-
113-
echo "➤ Committing files..."
114-
svn commit -m "Update to version $VERSION from GitHub" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
115-
116-
echo "✓ Plugin deployed!"

0 commit comments

Comments
 (0)