beads/scripts/gen-winres.sh
matt wilkie fa4dce4548
chore: re-land v1.1.0-rc.1 release prep (#4486)
Re-lands the v1.1.0-rc.1 release prep so the candidate can be reviewed before
the tag is cut (#4476 auto-merged the original prep; #4477 backed it out).

Restores v1.1.0-rc.1 version metadata across all package manifests, the
prerelease-aware release workflow and version scripts (prerelease tags skip the
stable docs-snapshot requirement and stay off the stable Homebrew/PyPI/npm
channels), the CHANGELOG and cmd/bd/info.go entries, and regenerates uv.lock to
1.1.0rc1.

Beyond the straight re-land:
- fix(release): match the winres/manifest numeric PE versions on the base
  version in update-versions.sh, so a later prerelease-to-different-base bump
  does not silently leave them stale.
- docs(release): document the prerelease / release-candidate workflow in
  RELEASING.md.

Agent-Signature: claude-opus-4-8-xhigh on behalf of matt wilkie
2026-06-25 20:10:18 -07:00

45 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
# gen-winres.sh - Generate Windows PE resource files (.syso) for bd.exe
#
# Embeds version info, application manifest, and metadata into Windows binaries.
# This helps reduce antivirus false positives by making the binary look like
# professionally packaged software (legitimate PE metadata).
#
# Usage:
# ./scripts/gen-winres.sh # Use version from version.go
# ./scripts/gen-winres.sh 0.49.4 # Explicit version
#
# Requires: go-winres (go install github.com/tc-hib/go-winres@latest)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
WINRES_DIR="$REPO_ROOT/cmd/bd/winres"
OUT_PREFIX="$REPO_ROOT/cmd/bd/rsrc"
# Determine version
if [[ $# -ge 1 ]]; then
VERSION="$1"
else
VERSION=$(grep 'Version = ' "$REPO_ROOT/cmd/bd/version.go" | sed 's/.*"\(.*\)".*/\1/')
fi
echo "[winres] Generating Windows PE resources for bd v${VERSION}"
PE_VERSION="${VERSION%%-*}"
# Check for go-winres
if ! command -v go-winres &> /dev/null; then
echo "[winres] Installing go-winres..."
go install github.com/tc-hib/go-winres@latest
fi
# Generate .syso files
go-winres make \
--in "$WINRES_DIR/winres.json" \
--out "$OUT_PREFIX" \
--product-version "$PE_VERSION" \
--file-version "$PE_VERSION"
echo "[winres] Generated:"
ls -la "$REPO_ROOT"/cmd/bd/rsrc_windows_*.syso 2>/dev/null || echo "[winres] (no .syso files found - check go-winres output)"