Skip to content

Commit a9924e5

Browse files
committed
scripts: extract script to upload assets to github release
1 parent fef3e2c commit a9924e5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
function usage() {
4+
echo "usage $(basename "$0") <version> <assets>..."
5+
echo
6+
echo "ARGS:"
7+
echo " <version> release version x.y.z (e.g 1.3.0)"
8+
echo " <assets>... list of assets paths"
9+
exit 1
10+
}
11+
12+
if [[ -z $1 ]]; then usage; fi
13+
if [[ $1 == *v* ]]; then
14+
echo "Version format must be: x.y.z (e.g 1.3.0)"
15+
usage
16+
fi
17+
if ! command -v gh >/dev/null; then
18+
echo "Missing gh command"
19+
usage
20+
fi
21+
if [[ -z $GITHUB_REPOSITORY ]]; then
22+
echo "Missing GITHUB_REPOSITORY env variable. Format must be owner/repo"
23+
usage
24+
fi
25+
26+
version="$1"
27+
28+
gh release upload "$version" \
29+
--repo "$GITHUB_REPOSITORY" \
30+
"${@:2}" # assets

0 commit comments

Comments
 (0)