upgrade command automates the full upgrade process: saves local changes, syncs with GitHub, installs the new version, updates templates, rebuilds, commits, and pushes.
Usage
npx thepopebot update
Version Targeting
Latest Stable
Beta/RC Channels
@latest— Latest stable release (default)@beta— Beta releases (pre-release testing)@rc— Release candidates (near-final testing)
Specific Version
- Downgrade to a previous version
- Pin to a specific release
- Test a particular version
Upgrade Workflow
Theupgrade command performs these steps automatically:
1. Pre-Flight Checks
- Verifies you’re in a thepopebot project (checks for
thepopebotinpackage.jsondependencies) - Resolves target version from npm registry
- Displays version change:
thepopebot 1.0.0 → 1.1.0 - Exits early if already up to date
2. Save Local Changes
If you have uncommitted changes, the upgrade commits them:3. Sync with Remote
Pulls the latest changes from GitHub:4. Install New Version
package.json, package-lock.json, and node_modules/.
5. Update Project Files
Runsinit using the new version’s templates:
.github/workflows/, docker-compose.yml, etc.) to match the new package version. See Init for details.
6. Clear Build Cache
Deletes.next/ to force a clean rebuild.
7. Build
8. Commit Upgrade
package.json, package-lock.json, updated templates, and any new files.
9. Push to GitHub
main. This triggers the rebuild-event-handler.yml workflow on your server, which:
- Detects the version change
- Runs
thepopebot initinside the container - Updates
THEPOPEBOT_VERSIONin the server’s.env - Pulls the new Docker image
- Stops the old container and starts a new one
- Runs
npm install --omit=dev - Builds
.nextand reloads PM2
10. Restart Docker (Local Only)
Ifdocker-compose.yml exists and containers are running:
11. Summary
Example Output
Successful Upgrade
Already Up to Date
Merge Conflict
Build Failure
Recovering from a Failed Upgrade
If an upgrade fails or leaves your server in a broken state, SSH into your server and rebuild manually:Merge Conflicts in Upgrade PR
If an automated upgrade PR (created byupgrade-event-handler.yml workflow) has merge conflicts, resolve them:
Option 1: GitHub UI
- Go to the PR in GitHub
- Click “Resolve conflicts”
- Edit files to keep the version you want
- Mark as resolved and merge
rebuild-event-handler.yml runs automatically.
Automated Upgrades
Two GitHub Actions workflows handle automated upgrades:1. upgrade-event-handler.yml (Manual Trigger)
Run from the Actions tab: Upgrade Event Handler > Run workflow
This workflow:
- Clones your repo into the event handler container
- Runs
npm update thepopebot - Creates an
upgrade/thepopebot-<version>-<timestamp>branch if the version changed - Opens a PR with auto-merge enabled
package.json and package-lock.json. It doesn’t run init, rebuild, or restart.
2. rebuild-event-handler.yml (On Push to Main)
Triggered automatically when the upgrade PR merges.
If THEPOPEBOT_VERSION in package.json changed, this workflow:
- Runs
npx thepopebot initto update templates - Commits template changes to
main - Updates
THEPOPEBOT_VERSIONin the server’s.env - Pulls the new Docker image
- Restarts the container
- Runs
npm install --omit=dev - Builds
.next - Reloads PM2
Diagnostic Commands
Use these to debug upgrade issues:Version History
Check your current version:Downgrading
To downgrade to a previous version, specify the version number:init, rebuilds, commits, pushes.
Warning: Downgrading may require manual template fixes if newer versions introduced breaking changes.