-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-release.sh
More file actions
executable file
·43 lines (35 loc) · 935 Bytes
/
Copy pathbuild-release.sh
File metadata and controls
executable file
·43 lines (35 loc) · 935 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
41
42
43
#!/usr/bin/env bash
set -euo pipefail
PLUGIN_SLUG="shortcode-to-blocks"
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DIST_DIR="$ROOT_DIR/dist"
STAGE_ROOT="$(mktemp -d)"
STAGE_DIR="$STAGE_ROOT/$PLUGIN_SLUG"
ZIP_PATH="$DIST_DIR/$PLUGIN_SLUG.zip"
cleanup() {
rm -rf "$STAGE_ROOT"
}
trap cleanup EXIT
mkdir -p "$DIST_DIR"
mkdir -p "$STAGE_DIR"
# Copy plugin files into a clean staging directory while excluding dev/system files.
rsync -a \
--exclude='.git/' \
--exclude='.github/' \
--exclude='.vscode/' \
--exclude='node_modules/' \
--exclude='tests/' \
--exclude='dist/' \
--exclude='.DS_Store' \
--exclude='Thumbs.db' \
--exclude='*.log' \
--exclude='*.map' \
--exclude='.gitignore' \
--exclude='build-release.sh' \
"$ROOT_DIR/" "$STAGE_DIR/"
rm -f "$ZIP_PATH"
(
cd "$STAGE_ROOT"
zip -rq "$ZIP_PATH" "$PLUGIN_SLUG" -x "*/.DS_Store" "__MACOSX/*"
)
echo "Release zip created: $ZIP_PATH"