-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.sh
More file actions
36 lines (29 loc) · 778 Bytes
/
package.sh
File metadata and controls
36 lines (29 loc) · 778 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
#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
plugin_dir="$script_dir"
if ! command -v jq >/dev/null 2>&1; then
echo "jq is required to read plugin version from plugin.json" >&2
exit 1
fi
plugin_id="$(jq -r '.id' "$plugin_dir/plugin.json")"
plugin_version="$(jq -r '.version' "$plugin_dir/plugin.json")"
out_dir="$plugin_dir/dist"
archive="$out_dir/${plugin_id}-${plugin_version}.tar.gz"
source_files=(
"plugin.json"
"ProcessListDesktop.qml"
"README.md"
"LICENSE"
"package.sh"
)
if [ -f "$plugin_dir/.gitignore" ]; then
source_files+=(".gitignore")
fi
mkdir -p "$out_dir"
tar \
--transform "s#^#${plugin_id}/#" \
-czf "$archive" \
-C "$plugin_dir" \
"${source_files[@]}"
echo "Created: $archive"