Skip to content

fix(workflows): Fix production release workflow - #299

Merged
vprashrex merged 2 commits into
mainfrom
fix/prod-deploy-home
Oct 30, 2026
Merged

vprashrex merged 2 commits into
mainfrom
fix/prod-deploy-home

Conversation

@vprashrex

@vprashrex vprashrex commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Closes #298

Summary

The production release workflow fails at "Wait for SSM command to finish" with fatal: $HOME not set, so v0.6.0 never reached production. Production is still on v0.5.0.

SSM AWS-RunShellScript runs as root without $HOME. The first remote command, git config --global --add safe.directory ..., needs $HOME to find the global git config, so it exits with code 128 before anything is deployed.

This PR adds export HOME=/root at 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 build and pm2 restart, all running as root.

Checklist

  • Ran npm run dev and npm run build in the repository root and test.
  • If you've fixed a bug or added code that is tested

Notes

  • Workflow-only change; the YAML parses. It can only be fully tested by a real release run.
  • This assumes npm and pm2 are 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 ran sudo -iu <user> pm2 restart. If the next release fails at npm ci or pm2 restart, that setup is what's missing.
  • Re-running the failed v0.6.0 workflow won't pick this up, because a tag runs the workflow file from its own commit. After this merges, cut v0.6.1 from main.

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
@vprashrex vprashrex added the bug Something isn't working label Oct 30, 2026
@vprashrex vprashrex self-assigned this Oct 30, 2026
@vprashrex
vprashrex requested a review from Ayush8923 October 30, 2026 06:51
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • ready-for-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot changed the title fix(deployment): Restore user env in production SSM deploy fix(workflows): Fix production release workflow Oct 30, 2026
Comment thread .github/workflows/create-release.yml Outdated
Comment on lines +66 to +75
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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

@vprashrex vprashrex added the enhancement New feature or request label Oct 30, 2026
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.
@vprashrex
vprashrex force-pushed the fix/prod-deploy-home branch from 54c3630 to 087c06d Compare October 30, 2026 06:55
@vprashrex
vprashrex requested a review from Ayush8923 October 30, 2026 06:57
@vprashrex
vprashrex merged commit 7c29ec6 into main Oct 30, 2026
2 checks passed
@vprashrex
vprashrex deleted the fix/prod-deploy-home branch October 30, 2026 06:58
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.6.1-main.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request released on @main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deployment: Fix $HOME issue

2 participants