Skip to content

Commit e60dac4

Browse files
committed
chore: update Glue
1 parent 32a8aa0 commit e60dac4

File tree

15 files changed

+295
-255
lines changed

15 files changed

+295
-255
lines changed

.glue/actions/auto/util-Bash-version-bump.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ main() {
77
local newVersion="$1"
88
ensure.nonZero 'newVersion' "$newVersion"
99

10-
# TODO: show which files changed
10+
# TODO: better output
11+
exec 8> >(xargs -r0 -- grep -l "PROGRAM_VERSION")
1112
find . -ignore_readdir_race -regex '\./pkg/.*\.\(sh\|bash\)' -print0 2>/dev/null \
12-
| xargs -r0 \
13-
sed -i -e "s|\(PROGRAM_VERSION=\"\).*\(\"\)|\1$newVersion\2|g"
13+
| tee /dev/fd/8 \
14+
| xargs -r0 -- sed -i -e "s|\(PROGRAM_VERSION=\"\).*\(\"\)|\1$newVersion\2|g"
15+
exec 8>&-
16+
17+
wait
1418
log.info "util-Bash-version-bump: Bump done"
1519
}
1620

.glue/actions/auto/util-get-version.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

.glue/actions/auto/util-release-post.sh

Lines changed: 0 additions & 70 deletions
This file was deleted.

.glue/actions/auto/util-release-pre.sh

Lines changed: 0 additions & 84 deletions
This file was deleted.

.glue/commands/auto/Bash.build.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@
22
eval "$GLUE_BOOTSTRAP"
33
bootstrap || exit
44

5-
# glue useAction(util-get-version.sh)
6-
util.get_action 'util-get-version.sh'
7-
source "$REPLY"
8-
declare newVersion="$REPLY"
9-
10-
# glue useAction(util-Bash-version-bump.sh)
11-
util.get_action 'util-Bash-version-bump.sh'
12-
source "$REPLY" "$newVersion"
5+
unset task
6+
task() {
7+
ensure.file 'glue-auto.toml'
8+
toml.get_key 'version' 'glue-auto.toml'
9+
local newVersion="$REPLY"
10+
11+
if [ -z "$newVersion" ]; then
12+
util.git_generate_version
13+
newVersion="$REPLY"
14+
fi
15+
16+
util.general_version_bump "$newVersion"
17+
18+
# glue useAction(util-Bash-version-bump.sh)
19+
util.get_action 'util-Bash-version-bump.sh'
20+
source "$REPLY" "$newVersion"
21+
}
22+
23+
task "$@"
24+
unset task
1325

1426
unbootstrap

.glue/commands/auto/Bash.release.sh

Lines changed: 88 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,92 @@
22
eval "$GLUE_BOOTSTRAP"
33
bootstrap || exit
44

5-
#
6-
# glue useAction(util-release-pre.sh)
7-
util.get_action 'util-release-pre.sh'
8-
source "$REPLY" 'notDry'
9-
newVersion="$REPLY"
10-
11-
# Bash version bump
12-
(
13-
find . -ignore_readdir_race -regex '\./pkg/.*\.\(sh\|bash\)' -print0 \
14-
| xargs -r0 \
15-
sed -i -e "s|\(PROGRAM_VERSION=\"\).*\(\"\)|\1${newVersion}\2|g" || :
16-
) || exit
17-
18-
# glue useAction(util-release-post.sh)
19-
util.get_action 'util-release-post.sh'
20-
source "$REPLY" 'notDry' "$newVersion"
21-
22-
# glue useAction(result-pacman-package.sh)
23-
util.get_action 'result-pacman-package.sh'
24-
source "$REPLY"
25-
26-
unset newVersion
5+
unset task
6+
task() {
7+
declare -g RELEASE_STATUS=dry
8+
for arg; do
9+
case "$arg" in
10+
--wet)
11+
# shellcheck disable=SC2034
12+
RELEASE_STATUS=wet
13+
esac
14+
done
15+
16+
ensure.cmd 'git'
17+
ensure.cmd 'gh'
18+
ensure.file 'glue-auto.toml'
19+
20+
if is.dry_release; then
21+
log.info "Running pre-release process in dry mode"
22+
else
23+
ensure.confirm_wet_release
24+
fi
25+
26+
# Perform build
27+
# TODO: perform build on commit hook etc.
28+
util.get_command 'Bash.build.sh'
29+
source "$REPLY"
30+
31+
# Ensure tests pass
32+
util.get_command 'Bash.test.sh'
33+
source "$REPLY"
34+
35+
# Build docs
36+
util.get_command 'Bash.docs.sh'
37+
source "$REPLY"
38+
39+
ensure.git_working_tree_clean
40+
ensure.git_common_history
41+
42+
local newVersion=
43+
if is.dry_release; then
44+
toml.get_key 'version' 'glue-auto.toml'
45+
newVersion="$REPLY"
46+
47+
ensure.nonZero 'newVersion' "$newVersion"
48+
else
49+
toml.get_key 'version' 'glue-auto.toml'
50+
util.prompt_new_version "$REPLY"
51+
newVersion="$REPLY"
52+
53+
ensure.nonZero 'newVersion' "$newVersion"
54+
ensure.version_is_only_major_minor_patch "$newVersion"
55+
ensure.git_version_tag_validity "$newVersion"
56+
fi
57+
58+
util.general_version_bump "$newVersion"
59+
60+
ensure.git_working_tree_dirty
61+
62+
if is.dry_release; then
63+
log.info "Skipping Git taging and artifact release"
64+
else
65+
git add -A
66+
git commit -m "chore(release): v$newVersion"
67+
git tag -a "v$newVersion" -m "Release $newVersion" HEAD
68+
git push --follow-tags origin HEAD
69+
70+
local -a args=()
71+
if [ -f CHANGELOG.md ]; then
72+
args+=("-F" "CHANGELOG.md")
73+
elif [ -f changelog.md ]; then
74+
args+=("-F" "changelog.md")
75+
else
76+
# '-F' is required for non-interactivity
77+
args+=("-F" "")
78+
log.warn 'CHANGELOG.md file not found. Creating empty notes file for release'
79+
fi
80+
81+
# Remote Release
82+
gh release create "v$newVersion" --target main --title "v$newVersion" "${args[@]}"
83+
fi
84+
85+
# glue useAction(result-pacman-package.sh)
86+
util.get_action 'result-pacman-package.sh'
87+
source "$REPLY"
88+
}
89+
90+
task "$@"
91+
unset task
92+
2793
unbootstrap

.glue/commands/auto/Bash.releaseDry.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)