Repository navigation
fix(workflows): Fix production release workflow - #299
Conversation
SSM AWS-RunShellScript runs as root without HOME set, so the first command (git config --global) failed with "fatal: $HOME not set" and blocked every production release. Restore what #292 dropped and what deploy-staging.yml still does: export HOME for the deploy user, load NVM, and restart pm2 as that user. Closes #298
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
| REMOTE_CMD="export HOME=/home/$ROOT_USER \ | ||
| && export NVM_DIR=/home/$ROOT_USER/.nvm \ | ||
| && . \$NVM_DIR/nvm.sh \ | ||
| && git config --global --add safe.directory $BUILD_DIRECTORY \ | ||
| && cd $BUILD_DIRECTORY \ | ||
| && git fetch origin --tags --prune \ | ||
| && git checkout $DEPLOY_SHA \ | ||
| && npm ci \ | ||
| && npm run build \ | ||
| && pm2 restart $APP_NAME" | ||
| && sudo -iu $ROOT_USER pm2 restart $APP_NAME" |
There was a problem hiding this comment.
maybe replace this with this:
REMOTE_CMD="export HOME=/root \
&& git config --global --add safe.directory $BUILD_DIRECTORY \
&& cd $BUILD_DIRECTORY \
&& git fetch origin --tags --prune \
&& git checkout $DEPLOY_SHA \
&& npm ci \
&& npm run build \
&& pm2 restart $APP_NAME"
Per review, keep the deploy running as root and set HOME=/root so git config --global works, instead of switching to the deploy user. Drop the ROOT_USER env, NVM setup and sudo pm2 restart.
54c3630 to
087c06d
Compare
|
🎉 This PR is included in version 0.6.1-main.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Issue
Closes #298
Summary
The production release workflow fails at "Wait for SSM command to finish" with
fatal: $HOME not set, sov0.6.0never reached production. Production is still onv0.5.0.SSM
AWS-RunShellScriptruns as root without$HOME. The first remote command,git config --global --add safe.directory ..., needs$HOMEto find the global git config, so it exits with code 128 before anything is deployed.This PR adds
export HOME=/rootat the start of the remote command in.github/workflows/create-release.yml. The rest of the deploy stays as #292 left it:git fetch --tags+git checkout $DEPLOY_SHA,npm ci,npm run buildandpm2 restart, all running as root.Checklist
npm run devandnpm run buildin the repository root and test.Notes
npmandpm2are on root's PATH on the production host, and that the app is registered in root's pm2. Before chore(deployment): Improve build process #292, production loaded NVM from the deploy user's home and ransudo -iu <user> pm2 restart. If the next release fails atnpm ciorpm2 restart, that setup is what's missing.v0.6.0workflow won't pick this up, because a tag runs the workflow file from its own commit. After this merges, cutv0.6.1frommain.