Git Auto Redeploy is a Go application that monitors specified Git repositories for changes and automatically runs custom commands when changes are detected. It is designed to be lightweight and efficient, making it suitable for use in automated deployment pipelines.
- Monitors multiple Git repositories for updates.
- Executes custom commands when updates are detected.
- Configurable check intervals and commands.
- Supports YAML configuration files.
- Can be set up as a daemon to run on system startup.
- Go 1.23 or later
- Git
-
Clone the repository:
git clone https://github.com/iooojik/git-autoredeploy cd git-autoredeploy
-
Build the application:
go build -o build/git-autoredeploy ./cmd/autodeploy/main.go
-
Configuration:
Create a configuration file named
config.yaml
in theconfigs
directory. Here's an example configuration:projects: - name: project1 repo: "[email protected]:username/project1.git" directory: "/path/to/project1" command: "bash deploy.sh" - name: project2 repo: "[email protected]:username/project2.git" directory: "/path/to/project2" command: "python deploy.py" check: interval: 60
-
Run the application:
./build/git-autoredeploy -config ./configs/
-
Command-line flags:
-config
: Specifies the directory where the configuration file is located. Default is the current directory.
-
Daemon Setup:
To set up the application as a daemon on Linux:
-
Create a systemd service file:
[Unit] Description=Git Auto Redeploy Service After=network.target [Service] ExecStart=/path/to/git-autoredeploy -config /path/to/configs Restart=always User=yourusername Group=yourusergroup WorkingDirectory=/path/to/working/directory [Install] WantedBy=multi-user.target
-
Reload systemd and start the service:
sudo systemctl daemon-reload sudo systemctl enable git-autoredeploy sudo systemctl start git-autoredeploy
-
Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.
This project is licensed under the MIT License. See the LICENSE
file for details.