forked from causa-prima/TIL3R
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrelease.zsh
executable file
·29 lines (23 loc) · 970 Bytes
/
release.zsh
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
#!/usr/bin/env zsh
yell() { echo "$*" >&2; }
die() { yell "$*"; exit 111; }
try() { "$@" || die "cannot $*"; }
# Process args
[[ "$1" == "-h" ]] && die 'Usage: release.zsh [<commit_to_tag> <version_tag>]'
version_tag="${2:-$(jq -r '.KPlugin.Version' metadata.json)}"
commit="${1:-HEAD}"
read -sq "?Create release ${version_tag} at git ref ${commit}? [y/n] " || die "Aborted." && echo
# Create .kwinscript release artifact
release_artifact="Ultrawide-Tiling-${version_tag}.kwinscript"
[ -e $release_artifact ] && try rm -vf $release_artifact
try zip -9 $release_artifact \
metadata.desktop\
contents \
LICENSE
yell "Creating git tag '${version_tag}'..."
try git tag --force "$version_tag" "$commit"
yell "Pushing tag to Github..."
remote=$(git for-each-ref --format='%(upstream:remotename)' "$(git symbolic-ref -q HEAD)")
try git push "$remote" "$version_tag"
echo "Creating Github release..."
try gh release create --draft "$version_tag" "$release_artifact"