-
Notifications
You must be signed in to change notification settings - Fork 347
/
publish
executable file
·50 lines (45 loc) · 1.18 KB
/
publish
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
44
45
46
47
48
49
50
#! /bin/bash
set -u
set -e
dry_run=
if [[ "${1:-}" == '-n' || "${1:-}" == '--dry-run' ]]
then
dry_run=echo
fi
generate_release_notes() {
OLDIFS="$IFS"
IFS=$'\n' changelog=( $(git-log-from-last-tag) )
IFS="$OLDIFS"
for l in "${changelog[@]}"
do
[[ "$l" == 'Bump' ]] && continue
printf '%s\n' "$l"
done
}
blue=$(tput setaf 32)
sgr0=$(tput sgr0)
eval $(grep version setup.py | sed 's/,$//')
tag="v$version"
title="v$version"
if which -s gh-token
then
gh-token
fi
$dry_run git tag "$tag" || printf 'WARNING: tag "%s" already exists\n' "$tag"
$dry_run git push --tags
if which -s gh
then
release_notes=$(mktemp)
generate_release_notes > "$release_notes"
$dry_run gh release create --title "$title" --notes-file "$release_notes" "$tag"
printf '\nNext steps:\n'
step=1
else
printf '\nNext steps:\n'
printf '1. Create new release on Github using tag=%s title=%s\n' "$tag" "$title"
printf ' url: %s%s%s\n' "${blue}" 'https://github.com/dtmilano/AndroidViewClient/releases/new' "${sgr0}"
printf '\n'
generate_release_notes
step=2
fi
printf '%d. Github Actions kicks off automatically to release new version\n' "$step"