mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 12:43:09 -05:00
* Include sync-server in auto-bumped versions * Fix version bump logic to work if the month has rolled over * Add release notes
54 lines
1.5 KiB
Bash
Executable File
54 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -gt 0 ]; then
|
|
version="${1#v}"
|
|
else
|
|
version=""
|
|
fi
|
|
|
|
files_to_bump=(
|
|
packages/api/package.json
|
|
packages/desktop-client/package.json
|
|
packages/desktop-electron/package.json
|
|
packages/sync-server/package.json
|
|
)
|
|
|
|
for file in "${files_to_bump[@]}"; do
|
|
if [ -z "$version" ]; then
|
|
# version format: YY.MM.patch
|
|
version="$(jq -r .version "$file" | perl -e '
|
|
($y,$m,$p)=split(/\./,<>);
|
|
($sec,$min,$hour,$day,$mon,$year)=localtime();
|
|
$year -= 100; # Perl year starts at 1900
|
|
$mon++; # Adjust 0-indexed month to 1-indexed
|
|
if ($y == $year && $m == $mon) {
|
|
if ($day <= 25) {
|
|
# Patch release for the current month
|
|
$p++;
|
|
} else {
|
|
# Use next month for a new release period
|
|
$p = 0;
|
|
$m++;
|
|
$m > 12 && ($m=1, $y++);
|
|
}
|
|
} else {
|
|
# Use the current date for a new release period
|
|
$y = $year;
|
|
$m = $mon;
|
|
$p = 0;
|
|
}
|
|
print "$y.$m.$p\n";
|
|
')"
|
|
|
|
if [ -z "$version" ]; then
|
|
echo "Error: Failed to calculate new version" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "Bumping $file to version $version"
|
|
jq '.version = "'"$version"'"' "$file" > "$file.tmp"
|
|
mv "$file.tmp" "$file"
|
|
done
|