Commit Graph

4 Commits

Author SHA1 Message Date
Vladimir Bryzgalov 1fd330fa0e refactor(release): use pretty download_url from /releases/{id} API
Gitea's POST /releases/{id}/assets endpoint returns an internal
/attachments/<uuid> URL. GET /releases/{id} returns the pretty
/<owner>/<repo>/releases/download/<tag>/<name> URL for the same asset.

Both resolve to the same bytes (verified: 207949 for 1.2.0 zip).
Pretty URL is preferred: filename is visible in the URL (better for
WP admin «View version details» and manual downloads), consistent
across Gitea instances (UUID format is git.netranking.ru-specific
Postgres attachment storage).

Also: switch `echo "$VAR" | jq` to `jq ... <<< "$VAR"`
herestring for CREATE_RESPONSE parsing — macOS /bin/echo can
interpret backslash-escapes in multi-line JSON bodies and corrupt
jq input.

wp-plugin-info.json for 1.2.0 patched in-place to use the pretty URL
for consistency with future releases. Both URLs continue to work;
domработница.рус's next PUC poll will refresh its local transient
to the pretty URL (version comparison stays 1.2.0 == 1.2.0, so no
update notice).

Closes cf7stg-pmf (T20).
2026-04-22 00:08:49 +05:00
Vladimir Bryzgalov 79e46ccf7e fix(release): post-mortem fixes discovered during 1.2.0 release
Issue 1: `unzip -l "$ZIP_PATH" | grep -q ...` combined with set -o
pipefail silently fails when grep -q exits on first match and SIGPIPEs
the upstream unzip (which has not yet finished streaming the long file
list). pipefail sees unzip's non-zero exit and fails the pipeline, so
the guard thinks the file is missing. Fix: capture unzip -l output to
a variable once, then grep the string via herestring. The first two
sanity checks using `unzip -p` (short output, tight race window) were
not affected.

Issue 2: test_wp_plugin_info_json_download_url_contains_expected_asset_name
assumed Gitea asset URLs always contain the asset filename. This is
not true on git.netranking.ru, which returns /attachments/<uuid> — a
UUID-only URL. Relaxed the test to assert the URL is an HTTPS Gitea
URL; freshness of download_url is enforced indirectly via the
version-match test.

Post-mortem: 1.2.0 release was completed via a manual recovery script
after release.sh failed at the zip-sanity step. State on main is
consistent: tag v1.2.0 -> release commit, JSON commit directly on top
of release commit, JSON points to the live Gitea asset.
2026-04-21 23:55:16 +05:00
Vladimir Bryzgalov 34e5571fea fix(release): replace \s with [[:space:]] in bump sed (BSD compat)
Critical: macOS BSD sed does not support \s character class.
The two substitutions in the version-bump step silently no-oped, the
grep fail-fast guard caught it (no remote damage), but release.sh
couldn't complete. Using POSIX [[:space:]] works on both BSD and GNU sed.

Also: extend test_git_archive_excludes_dev_files to cover .phpunit.result.cache,
.beads/, .claude/, dist/, .DS_Store — the test now fully enforces .gitattributes
export-ignore invariant.
2026-04-21 21:21:06 +05:00
Vladimir Bryzgalov 42b98e5438 feat(release): release.sh for one-shot releases to Gitea
Covers all 9 steps: validate (semver, tools, token, branch, clean tree,
tag not exists, readme changelog block) → bump (cf7-spam-to-telegram.php
header + CF7STG_VERSION, readme.txt Stable tag) → release commit + push →
build zip via git archive --worktree-attributes + sanity checks → Gitea
POST /releases with target_commitish=RELEASE_SHA → POST /releases/{id}/assets
→ regenerate wp-plugin-info.json (jq for version/download_url/last_updated,
awk for Changelog-to-HTML conversion) → JSON commit + push → summary echo.

Two fast-forward commits per release, no force-push. See
docs/superpowers/specs/2026-04-21-cf7stg-self-hosted-updates-design.md for
rationale.
2026-04-21 21:16:15 +05:00