-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·98 lines (78 loc) · 1.84 KB
/
release.sh
File metadata and controls
executable file
·98 lines (78 loc) · 1.84 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
set -euo pipefail
source ./update-deps.sh
# Required env vars:
# GITHUB_TOKEN - github repo api access
cmd=$1
shift
module=""
confirm_continue() {
local next_step="$1"
read -r -p "Continue to '$next_step'? [y/N] " reply
case "$reply" in
[yY]) return 0 ;;
*) return 1 ;;
esac
}
# Loop through remaining args
while [[ $# -gt 0 ]]; do
case "$1" in
-*)
echo "Unknown option: $1"
exit 1
;;
*)
# First non-flag argument is module
if [[ -z "$module" ]]; then
module=$1
shift
else
echo "Unexpected argument: $1"
exit 1
fi
;;
esac
done
if [[ -z "$module" ]]; then
echo "Module argument is required"
exit 1
fi
case "$cmd" in
prepare)
git fetch --tags
#run module tests
if [[ "$module" == "govulncheck" || "$module" == "renovate" ]]; then
: # Do nothing
else
dagger -m "$module/tests" checks
fi
dagger call --module="$module" prepare
version=$(cat "$module/VERSION")
echo "Please review the local changes, especially $module/releases/$version.md"
if confirm_continue approve; then
"$0" approve "$module"
fi
;;
approve)
version=$(cat "$module/VERSION")
notesPath="$module/releases/v$version.md"
# release material
git add "$module/VERSION" "$module/CHANGELOG.md" "$notesPath"
# signed commit
git commit -S -m "chore(release): prepare for $module/v$version"
# annotated and signed tag
git tag -s -a -m "Official release $module/v$version" "$module/v$version"
if confirm_continue publish; then
"$0" publish "$module"
fi
;;
publish)
# push this branch and the associated tags
git push --follow-tags
version=$(cat "$module/VERSION")
dagger call --module="$module" release --version="$version"
;;
*)
help
;;
esac