Probably the most common version control system used by developers today is git. Whether that is a self hosted server (like Gogs), a bare repo (git init) or with GitHub, most developers intuitively choose git. I try to store all my projects in local git repos and some of them make it to GitHub, while many of them don’t. When it comes to deploying apps to TIBCO Cloud Integration, I do many updates per day so I wanted an easy way to not only store my latest source but deploy it right after.
Enter git hooks …
Git hooks are scripts that run when a specific event occurs in your repository. You can configure what happens at commits (or right before), before patches, etc. Atlassian has a solid tutorial on the topic.
For my use case I created a Git post-commit script to deploy my Node.js apps directly to TIBCO Cloud Integration either using an environment variable or using a more interactive mode. The interactive mode gives me a ‘yes/no’ option after committing my new code to the repo, in case I have a fear of commitment ;-)
To get started, Windows only for now, clone my repo and copy the post-commit and post-commit.ps1 files to your repo’s root .git/hooks directory. It’s probably not a great idea to actually clone the repo into the internals of your repo.
Change the location of the tibcli executable in the post-commit.ps1 file on line 5 to where you keep the executable.
Select the mode you want to have by either commenting or uncommenting the mode on line 58 and 59 of the post-commit file.
Let me know your thoughts, concerns and suggestions!