fix(release): make release.sh portable across macOS and Linux

The nightly release workflow runs on Linux, but the script was written
with BSD-only idioms and had only ever been executed from a Mac. Every
scheduled nightly had been failing; the last successful nightly tag was
cut manually.

- days_since_2026: replace `date -j -f` (BSD) with a python3 one-liner
- sed -i: use the portable `sed -i.bak` + rm pattern; empty-suffix
  `sed -i ''` is a BSD-ism that breaks GNU sed's arg parsing

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-04-18 04:35:05 -04:00
parent 7f83a627ee
commit f4703d2cb5
No known key found for this signature in database

View file

@ -12,10 +12,7 @@ release_date() {
days_since_2026() {
local target_date="$1"
local epoch_2026 epoch_target
epoch_2026=$(date -j -f "%Y-%m-%d" "2026-01-01" "+%s")
epoch_target=$(date -j -f "%Y-%m-%d" "$target_date" "+%s")
printf '%s\n' $(( (epoch_target - epoch_2026) / 86400 ))
python3 -c "from datetime import date; print((date.fromisoformat('$target_date') - date(2026, 1, 1)).days)"
}
next_base_version() {
@ -150,7 +147,8 @@ main() {
return 0
fi
sed -i '' "s/^version = \"$current_version\"/version = \"$new_version\"/" "$cargo_toml"
sed -i.bak "s/^version = \"$current_version\"/version = \"$new_version\"/" "$cargo_toml"
rm "${cargo_toml}.bak"
echo "Updated $cargo_toml"
cargo update --workspace