One command release - #4546
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Add validation for --from, --type, --codename arguments to prevent set -u interpreter errors - Replace file-wide SC2034 disable with targeted disables for CODENAME and RELEASE_DIR only - Prevents future unused-variable typos from being silently ignored Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Implements stage_preflight() with comprehensive pre-release validation: - Clean working tree check (main repo and site repos) - Version consistency verification against System.php - CHANGELOG.md entry validation for release version - Site repository git checkout and pull verification - SSH connectivity validation to deployment targets - GitHub CLI authentication check - GPG key availability check (skippable via SKIP_GPG=1) All failure paths provide actionable error messages guiding users to resolve issues before proceeding with the release. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The previous dispatcher design invoked stages with || operators, which disabled set -e inside stage functions per POSIX semantics. This meant failing commands were silently swallowed instead of aborting the release process. Root cause fix: Replace the dispatcher loop with an EXIT trap design that keeps set -e active throughout stage execution. When any command fails: 1. set -e causes immediate exit from the stage 2. The EXIT trap runs and prints a resume hint with the exact stage/version 3. The script exits non-zero Instance fix: Add explicit error message to the git pull command for site repos, enabling git pull failures to be caught immediately rather than silently ignored. This ensures that: - Any failing command in any stage aborts the release immediately - Users get a clear resume command to fix issues and retry from that stage - No commands after a failure are silently executed Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Install dependencies and refresh data with pnpm - Validate or insert news entry for the release - Run tests and build the static site - Commit and push changes with version tag - Deploy to www.phpmyfaq.de via rsync - Verify homepage mentions the new version Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Implement stage_github_release: creates GitHub release with notes from CHANGELOG and all artifacts attached (--prerelease for development versions) - Add section 13.16 to docs/release.md with workflow documentation covering configuration, stages, options, and helper commands Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Resume hints reproduce --type/--codename/--dry-run so a resumed command never silently drops a dry-run flag and executes the real release. - github-release no longer treats an existing release as complete; it diffs actual GitHub assets against the expected nine and uploads whatever is missing instead of skipping a partially-uploaded release. - Add the same RELEASE_DIR guard update-api's sibling stages already have. - Surface the rsync --delete data-loss risk in update-api/update-www with inline warnings and matching docs/release.md notes. - Drop two shellcheck disables that are no longer load-bearing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a one-command release orchestrator with resumable stages, dry-run support, artifact publication, API and website deployment, and GitHub release creation. Adds PHP helpers and CLI tools for changelog extraction and release news drafts, with configuration, documentation, and PHPUnit tests. ChangesRelease automation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Operator
participant release.sh
participant BuildSystem
participant PackageServer
participant APIRepository
participant WebsiteRepository
participant GitHub
Operator->>release.sh: start release with version and options
release.sh->>release.sh: run preflight checks
release.sh->>BuildSystem: build and sign artifacts
release.sh->>PackageServer: publish packages and verify checksums
release.sh->>APIRepository: update, test, push, and deploy API release
release.sh->>WebsiteRepository: update, review, build, push, and deploy website release
release.sh->>GitHub: create release and upload assets
release.sh-->>Operator: report completion or resumable stage
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/release.sh (1)
93-95: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReduce fragility in
usage()'s hardcoded line-number extraction.
usage()extracts lines 3-12 of the script's own header comment viased -n '3,12p'. If a future edit inserts or removes a line anywhere in lines 1-12, the printed usage text silently becomes wrong or truncated, with no failure to signal the drift.Store the usage text as an explicit heredoc string instead, so it stays correct regardless of header-comment edits.
♻️ Proposed refactor
-usage() { - sed -n '3,12p' "$0" | sed 's/^# \{0,1\}//' -} +usage() { + cat <<'EOF' +One-command phpMyFAQ release orchestrator. + + ./scripts/release.sh <version> [--from <stage>] [--dry-run] + [--type stable|development] [--codename <name>] + [--print-type] + +Stages: preflight build publish-packages update-api update-www github-release +Configuration: ~/.config/phpmyfaq/release.conf (see scripts/release.conf.example) +EOF +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/release.sh` around lines 93 - 95, Replace the hardcoded line-range extraction in usage() with an explicit heredoc containing the complete usage text. Remove the sed-based self-reading logic so edits to the script header cannot alter or truncate the displayed help output.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/release-changelog.php`:
- Around line 26-37: Check the result of file_get_contents before casting or
passing it to ReleaseTools::extractChangelogSection: in
scripts/release-changelog.php lines 26-37, fail with a specific “Cannot read
CHANGELOG.md” error when the read returns false; apply the same explicit check
to the CHANGELOG.md read in scripts/release-news-draft.php lines 38-52, matching
its existing $newsFile error-handling pattern.
---
Nitpick comments:
In `@scripts/release.sh`:
- Around line 93-95: Replace the hardcoded line-range extraction in usage() with
an explicit heredoc containing the complete usage text. Remove the sed-based
self-reading logic so edits to the script header cannot alter or truncate the
displayed help output.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 34ccd32c-7570-4ced-917a-b9f00dbfab4a
📒 Files selected for processing (8)
docs/release.mdmago.tomlscripts/lib/ReleaseTools.phpscripts/release-changelog.phpscripts/release-news-draft.phpscripts/release.conf.examplescripts/release.shtests/phpMyFAQ/Release/ReleaseToolsTest.php
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary by CodeRabbit
New Features
Documentation
Tests