Commit Graph
5 Commits
Author SHA1 Message Date
orrisroot a036d3ef46 fix(scripts): report Gitea API errors in release uploads
The macOS and Linux release scripts called the Gitea API with
`curl -sf`, which discards the response on failure. A rejected token
surfaced only as a JSON decode error from the release id lookup.

- Route API calls through gitea_api, which keeps the HTTP status and
  the response body
- On failure print the status and Gitea's message, with a hint about
  the token scope on 401/403, and exit
- Look up the release first and create it only on 404 instead of
  ignoring every creation error
- Check the status of each asset upload
2026-11-04 20:15:15 +09:00
orrisroot e1081aeff4 fix(scripts): keep .env values out of the PowerShell session
A .ps1 runs inside the caller's PowerShell process, so the values the
Windows release script exported from .env outlived the script. A
later run in the same session kept the old GITEA_TOKEN even after .env
was edited, because existing environment variables take precedence.

- Read .env into a script-local table and resolve settings through
  Get-Setting, with environment variables still taking precedence
- Stop changing the caller's current location; build and archive
  with paths anchored at the repository root
- Skip .env lines without "=" instead of failing under StrictMode
2026-11-04 20:15:14 +09:00
orrisroot c24a285cf5 fix(selfupdate): verify the archive before replacing the binary
`mdrs selfupdate` replaced the running binary with whatever the release
endpoint returned, checking only that the transport succeeded. Nothing
proved the archive was the one the release publishes.

- Compare the downloaded archive against the release's `.sha256` asset
  and abort the update on a mismatch.
- Report a release that publishes no checksum as unverified, rather
  than letting its absence pass for a verified download.
- Exclude `.sha256` assets when matching the archive for the build
  target: those assets carry the target name too.
- Write and upload a checksum beside every archive, from the Gitea
  release workflow and the three local build scripts.
2026-09-04 16:31:02 +09:00
orrisrootandCopilot e8fd359f54 chore(scripts): add Linux release build script
Add scripts/build-release-linux.sh for building musl-linked release
archives (x86_64 and aarch64) on Linux. Uses `cross` for cross-
compilation so no host toolchain beyond Docker/Podman is required.

Also add mdrs-*.tar.gz and mdrs-*.zip to .gitignore to prevent
generated release archives from being tracked.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 13:50:08 +09:00
orrisrootandCopilot f0671c06ad feat: add manual release build scripts for macOS and Windows
CI does not have macOS or Windows runners, so provide scripts to
build and optionally upload release archives locally.

- scripts/build-release-macos.sh  — builds x86_64 and aarch64-apple-darwin
- scripts/build-release-windows.ps1 — builds x86_64-pc-windows-msvc
- scripts/.env.example             — template for Gitea credentials

Both scripts read GITEA_TOKEN, GITEA_SERVER_URL, and GITEA_REPOSITORY
from the environment or from scripts/.env (which is gitignored).
Upload to Gitea is skipped when GITEA_TOKEN is not set.

Use curl.exe for multipart upload in the PowerShell script to support
Windows PowerShell 5.1 (Invoke-RestMethod -Form requires PS 6.1+).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 11:44:22 +09:00