A few more web tweaks. Updated version stuff, made a small script to update all version strings.
This commit is contained in:
53
set-version.sh
Executable file
53
set-version.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
newVersion="${1:-}"
|
||||
|
||||
if [[ -z "$newVersion" ]]; then
|
||||
newVersion="$(date +%Y.%m.%d)"
|
||||
fi
|
||||
|
||||
if [[ ! "$newVersion" =~ ^[0-9]{4}\.[0-9]{2}\.[0-9]{2}$ ]]; then
|
||||
echo "Usage: $(basename "$0") [YYYY.MM.DD]" >&2
|
||||
echo "Error: version must match YYYY.MM.DD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cthulhuVersionFile="${scriptDir}/src/cthulhu/cthulhuVersion.py"
|
||||
mesonFile="${scriptDir}/meson.build"
|
||||
pkgbuildFile="${scriptDir}/distro-packages/Arch-Linux/PKGBUILD"
|
||||
|
||||
for path in "$cthulhuVersionFile" "$mesonFile" "$pkgbuildFile"; do
|
||||
if [[ ! -f "$path" ]]; then
|
||||
echo "Error: Missing file: $path" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
sed -i "s/^version = \".*\"/version = \"${newVersion}\"/" "$cthulhuVersionFile"
|
||||
sed -i "s/^ version: '.*',/ version: '${newVersion}',/" "$mesonFile"
|
||||
sed -i "s/^pkgver=.*/pkgver=${newVersion}/" "$pkgbuildFile"
|
||||
sed -i "s/^pkgrel=.*/pkgrel=1/" "$pkgbuildFile"
|
||||
|
||||
if ! rg -q "^version = \"${newVersion}\"" "$cthulhuVersionFile"; then
|
||||
echo "Error: Failed to update ${cthulhuVersionFile}" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! rg -q "^ version: '${newVersion}'," "$mesonFile"; then
|
||||
echo "Error: Failed to update ${mesonFile}" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! rg -q "^pkgver=${newVersion}$" "$pkgbuildFile"; then
|
||||
echo "Error: Failed to update ${pkgbuildFile}" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! rg -q "^pkgrel=1$" "$pkgbuildFile"; then
|
||||
echo "Error: Failed to reset pkgrel in ${pkgbuildFile}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Updated version to ${newVersion} in:" \
|
||||
"${cthulhuVersionFile}" \
|
||||
"${mesonFile}" \
|
||||
"${pkgbuildFile}"
|
||||
Reference in New Issue
Block a user