#git-repository #local-git #run-command #deployment #build #script #remote

bin+lib gw-bin

Watch git repositories, pull changes and run commands on the new files

5 unstable releases

0.2.2 Feb 17, 2024
0.2.1 Feb 11, 2024
0.2.0 Feb 9, 2024
0.1.1 Dec 9, 2023
0.0.1-rc2 Dec 9, 2023

#6 in #local-git

33 downloads per month

MIT license

63KB
1K SLoC

gw

Watch local git repositories, keep in sync with remote and run commands.

Motivation

gw is a lightweight binary that manages a simple pull-based continuous deployment for you. It watches a local git repository, fetches if the remote changes, and builds or deploys your code. Current CD solutions either lock you into proprietary software (e.g. Netlify or Vercel) or complicated to run and manage (e.g. ArgoCD). gw is a service that can run everywhere (even behind NAT or VPN), synchronizes code with your remote and deploys immediately, saving your developers time and energy.

Features of gw:

  • lightweight: it is only a 1.4MB binary
  • runs anywhere: use it on baremetal, systemd or docker
  • open source: written entirely in Rust, you can build it from source in a few minutes
  • pull-based: works on any network, even behind a NAT or VPN
  • flexible: build, deploy, restart or anything you can imagine

Get started

To get started download the gw binary from releases or install with cargo:

cargo binstall gw-bin
# or
cargo install gw-bin

Usage

All you have to do is point to a local repository and add a script to run if there is an update.

To get started, all you have to do is to point gw to a local repository. This will run git fetch periodically and pull if there are any changes.

gw /path/to/repo

To make it more useful, we can use the --script (or -s) flag to run commands when there are updates. You can define multiple scripts however for multiple commands or advanced logic, it is recommended to use a update.sh file in the repository.

gw /path/to/repo --script 'echo pulled'
gw /path/to/repo --script 'echo building' --script 'echo deploying'

To put this in the background simply wrap this in a systemd unit or docker container.

But this is not all gw can do. With a little creativity you can create a lot of things, for example:

...and many thing else. For a complete list, check out the guides page.

Dependencies

~12–23MB
~362K SLoC