A bash script to automate Angular builds and deploy to a remote server over SSH.
Our team was using GitLab CI/CD for deployments until we moved to a self-hosted GitLab instance. Setting up and maintaining runners, reconfiguring variables and handling auth was more hassle than it was worth for a small team. I had some shell scripting knowledge so I just built this instead — simple, transparent, and no infrastructure to maintain.
- Angular 18, Angular 20
- Linux (Ubuntu)
- Angular CLI
- Bash (Linux / macOS)
- SSH access to your server
- Clone the repo:
git clone https://github.com/turbolagged/ng-bash-deploy.git- Copy the example config and fill in your values:
cp deploy.config.example deploy.config-
Edit
deploy.configwith your server details and project path. -
Make the script executable:
chmod +x deploy.shRun from anywhere:
./deploy.sh deployThe script will ask you to:
- Select an environment (production / qa)
- Enter a base href (e.g.
/admin/, leave blank for/) - Confirm before deploying
- Validates the target folder exists on the server
- Builds the Angular app with your chosen environment and base href
- Uploads the build to a temp folder on the server
- Backs up the existing build with a timestamp
- Activates the new build
deploy.configis gitignored and never pushed- Backups are stored on the server with a timestamp in the folder name
- Script can be placed anywhere — project path is set in
deploy.config - Environment names (production / qa) must match your
angular.jsonconfigurations
- Zip / compress build before upload
- rsync support for faster uploads
- Rollback command
- Interactive config setup
Made by turbolagged · MIT License