Skip to content

Commit a151090

Browse files
committed
chore(release): v0.6.2
1 parent 60b27e7 commit a151090

File tree

18 files changed

+308
-67
lines changed

18 files changed

+308
-67
lines changed

.glue/actions/auto/tool-makepkg.sh renamed to .glue/actions/auto/result-pacman-package.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ main() {
1313
ensure.file glue.toml
1414
ensure.file glue-auto.toml
1515

16-
1716
# TODO: use function
1817
mkdir -p .glue/generated/tool-makepkg
1918

@@ -27,14 +26,18 @@ main() {
2726

2827
toml.get_key version glue-auto.toml
2928
local myVer="$REPLY"
29+
myVer="${myVer/-/_}"
3030

31+
ensure.nonZero 'myVer' "$myVer"
3132
# glue useConfig(tool-makepkg)
3233
util.get_config "tool-makepkg/dev/PKGBUILD"
3334
pkgbuildFile="$REPLY"
35+
36+
generated.in 'result-pacman-package'
3437
(
35-
cd .glue/generated/tool-makepkg || error.cd_failed
36-
# TODO: should this be handled by library function (remove generated subfolder)?
37-
rm -f PKGBUILD
38+
mkdir -p .glue/generated/tool-makepkg/dev
39+
cd .glue/generated/tool-makepkg/dev || error.cd_failed
40+
3841
cp "$pkgbuildFile" .
3942

4043
# TODO: bash templating
@@ -56,10 +59,9 @@ main() {
5659
sum="${sum%% *}"
5760
sed -i -e "s/sha256sums=.*\$/sha256sums=\('$sum'\)/g" PKGBUILD
5861

59-
6062
makepkg -Cfsrc
61-
)
62-
63+
) || exit
64+
generated.out
6365

6466
# TODO: think about more fine grained linting control in the whole SDLC
6567
# namcap PKGBUILD

.glue/actions/auto/tool-shdoc.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,24 @@ util.shopt -s dotglob
88
util.shopt -s globstar
99
util.shopt -s nullglob
1010

11-
declare outDir=".glue/generated/tool-shdoc"
12-
rm -rf "$outDir"
13-
for file in ./**/*.{sh,bash}; do
14-
if [[ $file == *'/.glue/'* ]]; then
15-
continue
11+
generated.in 'tool-shdoc'
12+
(
13+
if [ -d pkg ]; then
14+
cd pkg || error.cd_failed
1615
fi
1716

18-
declare output="$outDir/$file"
19-
mkdir -p "${output%/*}"
20-
output="${output%.*}"
21-
output="$output.md"
22-
shdoc < "$file" > "$output"
23-
done
17+
for file in ./**/*.{sh,bash}; do
18+
if [[ $file == *'/.glue/'* ]]; then
19+
continue
20+
fi
21+
22+
declare output="$GENERATED_DIR/$file"
23+
mkdir -p "${output%/*}"
24+
output="${output%.*}"
25+
output="$output.md"
26+
shdoc < "$file" > "$output"
27+
done
28+
) || exit
29+
generated.out
2430

2531
unbootstrap
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
eval "$GLUE_BOOTSTRAP"
3+
bootstrap || exit
4+
5+
main() {
6+
# If the working tree is dirty and there are unstaged changes
7+
# for both tracked and untracked files
8+
local dirty=
9+
if [ -n "$(git status --porcelain)" ]; then
10+
dirty=yes
11+
fi
12+
13+
# Get the most recent Git tag that specifies a version
14+
local version
15+
if version="$(git describe --match 'v*' --abbrev=0 2>/dev/null)"; then
16+
version="${version/#v/}"
17+
else
18+
version="0.0.0"
19+
fi
20+
21+
local id="$(git rev-parse --short HEAD)"
22+
version+="+$id${dirty:+-DIRTY}"
23+
REPLY="$version"
24+
}
25+
26+
main "$@"
27+
unbootstrap

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
unset main
99
main() {
10-
local newVersion="$1"
10+
local -r dryStatus="$1"
11+
local newVersion="$2"
12+
1113
ensure.nonZero 'newVersion' "$newVersion"
1214

1315
ensure.cmd 'git'

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

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env bash
2-
# eval "$GLUE_BOOTSTRAP"
3-
# bootstrap || exit
42

53
# @file util-release-pre.sh
64
# @brief Steps to perform before specialized version bumping
@@ -16,37 +14,70 @@ main() {
1614
ensure.cmd 'git'
1715
ensure.file 'glue-auto.toml'
1816

17+
local -r dryStatus="$1"
18+
isDry() {
19+
# must be set to 'notDry' to not be dry.
20+
# Defaults to 'not try'
21+
[ "$dryStatus" != "notDry" ]
22+
}
23+
24+
if isDry; then
25+
log.info "Running release process in dry mode"
26+
fi
27+
1928
# Ensure working tree not dirty
2029
if [ -n "$(git status --porcelain)" ]; then
21-
die 'Working tree still dirty. Please commit all changes before making a release'
30+
if isDry; then
31+
local cmd="log.warn"
32+
else
33+
local cmd="die"
34+
fi
35+
36+
"$cmd" 'Working tree still dirty. Please commit all changes before making a release'
2237
fi
2338

2439
# Ensure we can push new version and its tags changes without --force-lease
2540
if ! git merge-base --is-ancestor origin/main main; then
41+
if isDry; then
42+
local cmd="log.warn"
43+
else
44+
local cmd="die"
45+
fi
46+
2647
# main NOT is the same or has new additional commits on top of origin/main"
27-
die "Detected that your 'main' branch and it's remote have diverged. Won't initiate release process until histories are shared"
48+
"$cmd" "Detected that your 'main' branch and it's remote have diverged. Won't initiate release process until histories are shared"
2849
fi
2950

30-
# Get current version
31-
toml.get_key version glue-auto.toml
32-
local currentVersion="$REPLY"
33-
34-
# Get new version number
35-
# TODO: make incremenet better
36-
echo "Current Version: $currentVersion"
37-
read -rp 'New Version? ' -ei "$currentVersion"
38-
local newVersion="$REPLY"
39-
declare -g REPLY="$newVersion" # explicit
40-
41-
# Ensure new version is valid (does not already exist)
42-
if [ -n "$(git tag -l "v$newVersion")" ]; then
43-
# TODO: ensure there are no tag sthat exists that are greater than it
44-
die 'Version already exists in a Git tag'
51+
local newVersion=
52+
if isDry; then
53+
# Calculate new version based on current commit
54+
55+
# glue useAction(util-get-version.sh)
56+
util.get_action "util-get-version.sh"
57+
source "$REPLY"
58+
newVersion="$REPLY-DRY"
59+
else
60+
# Prompt for new version
61+
62+
# Get current version
63+
toml.get_key version glue-auto.toml
64+
local currentVersion="$REPLY"
65+
66+
# Get new version number
67+
# TODO: make incremenet better
68+
echo "Current Version: $currentVersion"
69+
read -rp 'New Version? ' -ei "$currentVersion"
70+
newVersion="$REPLY"
71+
declare -g REPLY="$newVersion" # explicit
72+
73+
# Ensure new version is valid (does not already exist)
74+
if [ -n "$(git tag -l "v$newVersion")" ]; then
75+
# TODO: ensure there are no tag sthat exists that are greater than it
76+
die 'Version already exists in a Git tag'
77+
fi
4578
fi
4679

4780
sed -i -e "s|\(version[ \t]*=[ \t]*\"\).*\(\"\)|\1${newVersion}\2|g" glue-auto.toml
4881
}
4982

5083
main "$@"
51-
52-
# unbootstrap

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
eval "$GLUE_BOOTSTRAP"
3+
bootstrap || exit
4+
5+
# glue useAction(util-release-pre.sh)
6+
util.get_action 'util-release-pre.sh'
7+
source "$REPLY" 'dry'
8+
newVersion="$REPLY"
9+
10+
sed -ie "s|\(version[ \t]*=[ \t]*\"\).*\(\"\)|\1${newVersion}\2|g" glue-auto.toml
11+
12+
unbootstrap

.glue/commands/auto/Bash.ci.sh

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

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ bootstrap || exit
44

55
# glue useAction(util-release-pre.sh)
66
util.get_action 'util-release-pre.sh'
7-
source "$REPLY"
7+
source "$REPLY" 'notDry'
88
newVersion="$REPLY"
99

1010
# TODO: generalize
1111
sed -i -e "s|\(PROGRAM_VERSION=\"\).*\(\"\)|\1${newVersion}\2|g" glue.sh || :
1212

1313
# glue useAction(util-release-post.sh)
1414
util.get_action 'util-release-post.sh'
15-
source "$REPLY" "$newVersion"
15+
source "$REPLY" 'notDry' "$newVersion"
1616

17-
# glue useAction(tool-makepkg.sh)
18-
util.get_action 'tool-makepkg.sh'
17+
# glue useAction(result-pacman-package.sh)
18+
util.get_action 'result-pacman-package.sh'
1919
source "$REPLY"
2020

2121
unset newVersion
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
eval "$GLUE_BOOTSTRAP"
3+
bootstrap || exit
4+
5+
# glue useAction(util-release-pre.sh)
6+
util.get_action 'util-release-pre.sh'
7+
source "$REPLY" 'dry'
8+
newVersion="$REPLY"
9+
10+
# TODO: generalize
11+
sed -i -e "s|\(PROGRAM_VERSION=\"\).*\(\"\)|\1${newVersion}\2|g" glue.sh || :
12+
13+
# glue useAction(util-release-post.sh)
14+
util.get_action 'util-release-post.sh'
15+
source "$REPLY" 'dry' "$newVersion"
16+
17+
# glue useAction(result-pacman-package.sh)
18+
util.get_action 'result-pacman-package.sh'
19+
source "$REPLY"
20+
21+
unset newVersion
22+
23+
unbootstrap

.glue/common/auto/generated.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
generated.in() {
4+
local dir="$1"
5+
ensure.nonZero 'dir' "$dir"
6+
7+
# shellcheck disable=SC2034
8+
declare -g GENERATED_DIR="$GLUE_WD/.glue/generated/$dir"
9+
10+
if [ -d "$GLUE_WD/.glue/generated/$dir" ]; then
11+
rm -rf "$GLUE_WD/.glue/generated/$dir"
12+
fi
13+
mkdir "$GLUE_WD/.glue/generated/$dir"
14+
15+
# TODO: clean up print
16+
echo "-- generated.in: '$GENERATED_DIR'"
17+
}
18+
19+
generated.out() {
20+
echo "-- generated.out '$GENERATED_DIR'"
21+
22+
cd "$GLUE_WD" || error.cd_failed
23+
}

0 commit comments

Comments
 (0)